Sample data:
Date City Name
--------------------------
1/2/2011 New York John
5/1/2011 Chicago Matt
2/1/2011 Chicago Mark
9/2/2011 New York Johnny
3/1/2011 Boston Phil
5/1/2011 Chicago Martin
9/1/2011 Boston Neil
2/2/2011 New York Nicholas
1/2/2011 New York Tom
3/2/2011 Chicago Eric
5/1/2011 New York Jack
12/1/2011 Chicago Peter
11/2/2011 New York Paul
9/2/2011 Boston Steve
I need to take 3 more recent reports about every other city. I mean the three newest recordings of New York, Boston and Chicago.
I know that I can do this in PHP, but imagine that there are thousands of records in this table, it is not useful to take all the records and transfer them to PHP: P
How is this possible in a single MySQL query?
Thank!
source
share