Re: ORDER BY AND GROUP BY CLAUSE



On Nov 27, 5:34 pm, "Tony Rogerson" <tonyroger...@xxxxxxxxxx> wrote:
Both are very different products.

Try this...

SELECT id, max( date )
FROM anytable
GROUP BY id
ORDER BY id, date desc

The jibe about ansi standards and MS not following them is a bit cheap, in
SQL Server you can use the ansi standard if you want - well, a lot of the 92
implementation anyway.

I'm not familiar with vfp - does it follow the ansi standard - the syntax
you posted doesn't look familiar.

--
Tony Rogerson, SQL Server MVPhttp://sqlblogcasts.com/blogs/tonyrogerson
[Ramblings from the field from a SQL consultant]http://sqlserverfaq.com
[UK SQL User Community]

Hi Tony,

VFP supports multiple standards including their own sql standards.
There is an engine behavior flag that governs which variation FoxPro
Uses.

If you are interested here is a link to another forum about it...
http://fox.wikis.com/wc.dll?Wiki~Enginebehavior~VFP

The syntax I ended up using was a variant of this, with part of it
wrapped in a CTE for readability.
Just seemed like a lot of code for such a simple task ... Moveover my
last post was incorrect it should
not have said duplicate records.

SELECT I1.invoice_nbr, C.customer_name, C.shopping_addr, C.acct_nbr
FROM Invoices AS I1,
Customers AS C
WHERE I1.acct_nbr = C.acct_nbr
AND I1.posting_date
= (SELECT MAX(I2.posting_date)
FROM Invoices AS I2
WHERE I2.acct_nbr = C.acct_nbr);


I only been coding in sql server 2005 for about 6 month... I been
using foxbase then vfp forever however with it's end of life all new
projects are in sql
and there just seems to be ALOT more coding involved to accomplish the
same task, especially when doing anything on a row by row level ....
SQL also lacks a built in debugger going into .NET is a pain . . .

But what can you do :) ....

I will try your suggestion and thanks everyone for the help...

Bryan
.



Relevant Pages

  • Re: Jet SQL vs. standard SQL
    ... Most of the Jet extensions to ANSI SQL were included in the ... Any ANSI standard db engine should accept ...
    (microsoft.public.access.queries)
  • Re: Data Access...
    ... It would be nice if we could get an ANSI standard SQL compliant way to ... Data manipulation, navigation, etc... ... The same way SQL Server and every other SQL compliant database handles it. ... Using the ANSI standard is a better soution, ...
    (microsoft.public.dotnet.framework)
  • Re: Data Access...
    ... > originally had to deal with DATA ACCESS lets talk in terms of DATA ACCESS. ... > manipulate data, for those people that need to manipulate data in ... >> SQL wouldn't accommodate everyone to start with. ... > Using the ANSI standard is a better soution, ...
    (microsoft.public.dotnet.framework)
  • Re: So whats null then if its not nothing?
    ... I just read that the ANSI standard says NULL is char! ... If you're referring to the ANSI standard for SQL, ... because it violates the standard). ...
    (comp.databases.theory)
  • SV: Foxpro Programming
    ... Experience with SQL Server is fine if they use VFP as a front end for SQl ... Any experience with the standard SQL language is fine as VFP also ...
    (microsoft.public.fox.programmer.exchange)