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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying last status by date criteria

Status
Not open for further replies.

zuza

Programmer
Nov 9, 2003
54
YU
Dear all,
I have a status table where the DS# are entered as history like :
DS# Status date
DS000001 --- claim received -- 12/03/2003
DS000001 --- notification completed -- 12/06/2003
DS000002 --- claim received -- 21/02/2004
DS000002 --- HPCC decisions -- 20/03/2004

They're asking me to display DS # ONCE with the last status(that means with the max date) nearby.

I hope you got the point.

Rgds,
ZuZa.
 
This might do the trick...
Code:
strSQL = "SELECT DISTINCT DS, Status from myStatusTable ORDER BY [date] DESC;"

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Try this:

SELECT t1.*
FROM [MyTable] t1
WHERE t1.[date] In (select top 1 t2.[date] from [MyTable] t2 where t2.[DS#] = t1.[DS#] ORDER BY t2.[date] DESC)


-VJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top