I'm trying to select the first 5 amounts above 2000 and the first 5 below 2000 and return the data in a single resultset.
SELECT TOP 5 *
FROM bid
WHERE amount >= 2000
ORDER BY amount ASC
UNION
SELECT TOP 5 *
FROM bid
WHERE amount < 2000
ORDER BY amount DESC
Looks like this is not how union
is supposed to be used as I'm getting a runtime error.
Incorrect syntax near the keyword 'union'.
What's the correct way of writing the desired query?