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
6 Comments »
RSS feed for comments on this post. TrackBack URL
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.
sexy latin woman…
gimmemoney 534312 Description of sexy latin woman….
If you have an auto_increment column,
SELECT * FROM my_table ORDER BY auto_increment_col DESC LIMIT 1
Great wishes! Smith wesson model 64 lzomg
Lovely. Made my day (which is saying something)
Thank you, I just wanted to give a greeting and tell you I like your website very much.