I get Errors that ORDER should appear after UNION, but I want these requests to be ordered before merging, and then limited to 10.
SELECT *
FROM (SELECT time, x, y, z
FROM db
WHERE time >= now
ORDER by time, x
UNION
SELECT time, x, y, z
FROM db
WHERE time < now
ORDER by time, x)
LIMIT 10
I hope you understand what I'm trying to do and can help me ,-)
source
share