I have the following query:
Now I need to merge another query, that has a different "ORDER BY":
I've tried to add it as above, but it doesn't work.
What's wrong?
Thanks in advance.
(SELECT
Url, Ref, Text, DateTime, 'C1' AS Source
FROM Tbl
WHERE Category = 'C1')
UNION
(SELECT
Url, Ref, Text, DateTime, 'C2' AS Source
FROM Tbl
WHERE Category = 'C2')
UNION
(SELECT
Url, Ref, Text, DateTime, 'C3' AS Source
FROM Tbl
WHERE Category = 'C3')
ORDER BY DateTime DESC
Now I need to merge another query, that has a different "ORDER BY":
UNION
(SELECT
Url, Ref, Text, Expiration, 'C4' AS Source
FROM Tbl
WHERE Category = 'C4' AND Expiration >= CURDATE()
ORDER BY Expiration ASC)
I've tried to add it as above, but it doesn't work.
What's wrong?
Thanks in advance.
Last edited: