Select Last Entries from MySQL
I have a log and I want to list the last time an entry was made by each of the users
SELECT user_id, MAX( log_date ) AS date,
DATE_FORMAT( MAX( log_date ) , "%M, %Y" ) AS english_date
FROM log_table
GROUP BY user_id
I’m not sure if this is the best way. The other options is to use WITH ROLLUP, I didn’t look into that option. This one seems to work, the only iffy part is the MAX(log_date), I may be pushing it just a bit ![]()



February 2nd, 2006 at 7:48 am
ummm, isn’t this the *textbook* way to do this. in other words, i think this is pretty much how you’res supposed to do this.
January 19th, 2007 at 1:12 am
sexy latin woman…
gimmemoney 534312 Description of sexy latin woman….
April 5th, 2007 at 12:25 am
If you have an auto_increment column,
SELECT * FROM my_table ORDER BY auto_increment_col DESC LIMIT 1
April 2nd, 2008 at 9:52 pm
Great wishes! Smith wesson model 64 lzomg
July 12th, 2008 at 4:13 am
Lovely. Made my day (which is saying something)