How about:

SELECT DISTINCT ClientID,MAX(DateTimeOrder) FROM Orders GROUP BY ClientID


Add a WHERE clause to limit the result set.


Regards,
Rommel


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of J.M. GRATIAS
Sent: Thursday, December 12, 2002 4:32 PM
To: Rbase List server
Subject: SQL question ...



Hi all,


I have a table which contains all the orders from all the clients :

#ORDER
#CLIENT
DateTimeOrder
....

I need to keep only the more recent order from each client.

Any Idea how to do that without using DECLARE Cursor ?

TIA

J.M. GRATIAS, Logimatique
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to