Deceptive MySQL Query
Posted
by jerebear
on Stack Overflow
See other posts from Stack Overflow
or by jerebear
Published on 2010-03-30T18:25:53Z
Indexed on
2010/03/30
18:33 UTC
Read the original article
Hit count: 261
mysql-query
So I don't consider myself a novice at MySQL but this one has me stumped:
I have a message board and I want to pull a list of all the most recent posts grouped by the Thread ID.
Here's the table:
MB_Posts
-ID
-Thread_ID
-Created_On (timestamp)
-Creator_User (user_id)
-Subject
-Contents
-Edited (timestamp)
-Reported
I've tried many different things to keep it simple but I would like help from the community on this one.
Just to kick this out there...this one does not work as expected:
SELECT * FROM MB_Posts GROUP BY Thread_ID ORDER BY ID DESC
© Stack Overflow or respective owner