Jul 29 2009

mysql bizarre self union

Category: Uncategorizedben @ 9:31 am

i wanted to use this:

(select * from Seasons where id=5) union
(select * from Seasons where id<>5 order by id desc);

but i had to use this:

SELECT * FROM
(SELECT * FROM Seasons
WHERE id=5
ORDER BY id DESC) AS t1

UNION

SELECT * FROM
(SELECT * FROM Seasons
WHERE id<>5
ORDER BY id desc) AS t2

Leave a Reply

You must be logged in to post a comment.