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

Getting recent date

Status
Not open for further replies.

sarakmo

IS-IT--Management
Sep 4, 2007
4
US
Greetings,

I'm trying to retrieve the most recent date for each code.

for example:
Table A
code Date
code111: 02/10/2005
code111: 03/10/2006
code111: 03/10/2007
code122: 04/10/2000
code122: 03/10/2003
code122: 03/10/2007

I'm trying to retrieve the most recent date for each code and use it in a large query.

Right now I've tried dumping my MAX(date) results in a temp table...but obviously the 'max' date in this case returns the only date it has.

Please help!

Appreciate it greatly. [:)]
 
Can you show us the code you have so far? Without knowing for sure, I would guess that you are missing the group by clause in your query.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
select code, max(codeDate)
from #test
group by code

< M!ke >
[small]I can say nothing, which is cowardly, I can lie, which is immoral, or I can tell the truth, which will upset people. - Tiki Barber[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top