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

MYSQL query help - finding the min of the maxes

Status
Not open for further replies.

MeganG

Programmer
Feb 8, 2008
2
0
0
US
Hello!

I am not as proficient with SQL as I used to be, so I am having trouble writing a query. Here is the table structure:

ID (auto-incrementing)
PrimaryProductKey
RelativeProductKey
LastIndexed (datetime)

A sample dataset would be:

1, 2, 1, 2008-02-06 10:27:18
2, 2, 2, 2008-02-05 10:27:18
3, 2, 1, 2008-02-04 10:27:18
4, 5, 1, 2008-02-06 9:00:00

I would like to find a) the MAX datetime stamp per PrimaryProductKey key, and then b) find the MIN of that result. So for this dataset, that would return a) 2008-02-06 10:27:18, 2008-02-06 9:00:00 and then b) 2008-02-06 9:00:00 . I don't really need the results from a, I just need the final datetime stamp returned from b.

Thanks so much for your help!
-- Megan
 
Hello again -

Scratch that, I have found a much simpler way to find the information I need. Sorry!

-- Megan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top