Hi,
I have three tables, each contain an auto-incrementing PK. I need to select the latest (ie, ORDERBY DESC) entries from the mix of these tables.
I'd like to do it in one query, with two joins.
My idea was is to somehow select a table, order it by id DESC
, then somehow merge the results.
Does anyone have a way (or probably a better idea) of doing this?
(using mysql)
EDIT:
Sorry - here's a more detailed spec:
I have three tables, posts
, stories
, favs
.
Each has (at the least) three columns id
, uid
and date
. They are both PK's. id
auto-increments (separately for each table). uid
is FK, but that's irrelevant. I need the result set to contain the latest 20 or 30 entries.