Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query on sql......a bit urgent

Status
Not open for further replies.

yukeshean

Programmer
Aug 24, 2001
9
MY
i have one table with the follwing recordset:

groupname price date
aaa 1.00 13/06/2002
aaa 2.00 01/07/2002
aaa - 01/06/2002
bbb 1.00 01/08/2002
cc 5.00 03/06/2002
cc - 18/05/2002

how to get all the frist row in each group (groupname) order by date desc?? means that i want to select the following result out.
aaa 2.00 01/07/2002
bbb 1.00 01/08/2002
cc 5.00 03/06/2002


Looking forward for help.....A bit urgent here. Please do give some advice. TQ in advance for ur help! :)

Regards,
yukeshean
 
try...

Code:
 SELECT DISTINCT groupname, price, date FROM TABLE_NAME ORDER BY date
 
Try this.

Select groupname, price, [date]
From tblname t
Where [date]=
(Select Max([date])
From tblname
Where groupname=t.groupname) Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top