• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Finding the Greatest ID in a MySQL Table

Niaad

New Member
I have a MySQL table which contains about 50 records, each record belonging to a different category (I'll refer to them as A, B, and C). All the records are related in the sense that they don't have individual ID counts...ID 1 might be C, ID 2 might be B, ID 3 might be C again...etc.

What I need to display is out of all the records in the "A" category, display the one with the highest ID out of all of them.

And then out of all the records in the "B" category display the record with the highest ID...etc.

I was thinking about using mysql_numrows (then just displaying the count of the records, because that would obviously be the highest ID...), but I realized that wouldn't work...since say the newest ID for the "A's" is 50, and numrows counts all the records with the "A" category and gets 20, and then displays ID 20...well, that won't work.

I feel as if I am missing something obvious here, almost as if it's on the tip of my tounge...if anybody has any input, please post it .
 
Back
Top