Re: ORDER BY AND GROUP BY CLAUSE



On Nov 27, 12:40 pm, bwalton_...@xxxxxxxxx wrote:
I'm completely lost why a trival task in VFP is a lengthy drawn out
process in SQL Server

For Example

A simple select statement where I want to return the most current date
from a table along with the unique identifier for the row selected is
a single select statement in VFP

SELECT TOP 1 date, id
FROM anytable
ORDER BY id, date desc
GROUP BY id

OR Another example

SELECT invoice.number, customer.name, customer.address, invoice.id,
customer.id
FROM invoice
INNER JOIN customer
ON invoice.customerid = customer.id
ORDER BY customer.id, invoice.date DESC
GROUP BY customer.id

This will return the most recent order for a customer

Niether selects statements are supported in SQL Server 2005... Is
there a logical reason WHY? Other then ansi standards which I'm not
buying as m$ft rarely follows any standards but there own 100% of the
time anyway.

Also could someone please post the most efficent SQL syntax to accomplish the above as I would like to determine if I am missing something here.

Thanks In Advance
Bryan


.



Relevant Pages

  • Re: why the permissions dont work anymore?
    ... SQL Server doesn't randomly decide to do such devious things:). ... There has to be a logical reason. ... Most likely someone is running a script that does more than they think or the database has been restored and the permissions were not reset properly. ...
    (microsoft.public.sqlserver.security)
  • Re: mssql: insert into syntax
    ... As far as I know the latter is also compliant with ANSI standards. ... The first syntax is something I've never seen before. ... Indeed, just because it is the standard, does not mean that it is ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: Want to Load Data MS Access Sql Server 2000
    ... Why load the data into Access, clean up the data and then load it back to ... Assuming there is some logical reason have you tried using the ... SQL Server MVP ...
    (microsoft.public.sqlserver.dts)