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 ;)

5 Responses to “Select Last Entries from MySQL”

  1. gcomnz Says:

    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.

  2. sexy latin woman Says:

    sexy latin woman…

    gimmemoney 534312 Description of sexy latin woman….

  3. Alexey M. Says:

    If you have an auto_increment column,

    SELECT * FROM my_table ORDER BY auto_increment_col DESC LIMIT 1

  4. fygyy Says:

    Great wishes! Smith wesson model 64 lzomg

  5. insurance life fidelity life insurance Says:

    Lovely. Made my day (which is saying something)

Leave a Reply