Re: ORDER BY AND GROUP BY CLAUSE
- From: bwalton_707@xxxxxxxxx
- Date: Tue, 27 Nov 2007 09:42:06 -0800 (PST)
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
.
- Prev by Date: Re: FOREACH LOOP container and looping through record set ...
- Next by Date: Is there a way to check if INDENTITY is enabled on a table?
- Previous by thread: Off Topic - Databindings and XML - Binding Text between XML Tags instead of XML Tag Atrribute Information
- Next by thread: Re: ORDER BY AND GROUP BY CLAUSE
- Index(es):
Relevant Pages
|