J
J Miro
Suppose you have a table named Orders with some fields including: PK,
CustName, OrderDate. PK is an autonumber field, so although a customer may
have multiple records, each record will have a unique value in the PK field.
How would you write the SQL statement to return the most recent order record
for all the customers?
PK CustName OrderDate
1 John Doe 5/5/05
2 Bob Smith 5/7/05
3 John Doe 5/10/05
4 Bob Smith 5/11/05
Using the sample above, records 3 and 4 would be returned:
3 John Doe 5/10/05
4 Bob Smith 5/11/05
Thanks in advance. J. M.
CustName, OrderDate. PK is an autonumber field, so although a customer may
have multiple records, each record will have a unique value in the PK field.
How would you write the SQL statement to return the most recent order record
for all the customers?
PK CustName OrderDate
1 John Doe 5/5/05
2 Bob Smith 5/7/05
3 John Doe 5/10/05
4 Bob Smith 5/11/05
Using the sample above, records 3 and 4 would be returned:
3 John Doe 5/10/05
4 Bob Smith 5/11/05
Thanks in advance. J. M.