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 to show row with older date 1

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
US
Hi,

I have a table similar to the following example:

ColumnA ColumnB
==================
A 01/02/2006
B 10/10/2005
A 01/01/2006
C 10/10/2005
D
E 11/10/2005

I would appreciate help in writing a query that will capture data like this:

ColumnA ColumnB
==================
A 01/01/2006
B 10/10/2005
C 10/10/2005
E 11/10/2005

Basically, doesn't matter how many times a value under ColumnA may re-appear, only the one with oldest date would be captured by the query.

Thanks,

Mike
 
SELECT ColumnA, Min(ColumnB) As OlderDate
FROM yourTable
GROUP BY ColumnA

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you! I kept thinking the Min function needs to be placed somewhere outside of the "SELECT.." statement.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top