We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I have an error:
SELECT TOP 1 CITY, LEN(CITY) FROM STATION ORDER BY LEN(CITY),CITY
UNION
SELECT TOP 1 CITY, LEN(CITY) FROM STATION ORDER BY LEN(CITY) DESC,CITY;
Msg 156, Level 15, State 1, Server WIN-BN5QSPCERQI, Line 3
Incorrect syntax near the keyword 'UNION'.
And we should use UNION ALL for the best plan, because it doesn't sort our data.
Weather Observation Station 5
You are viewing a single comment's thread. Return to all comments →
Could you show us how does it work?
I have an error: SELECT TOP 1 CITY, LEN(CITY) FROM STATION ORDER BY LEN(CITY),CITY UNION SELECT TOP 1 CITY, LEN(CITY) FROM STATION ORDER BY LEN(CITY) DESC,CITY;
Msg 156, Level 15, State 1, Server WIN-BN5QSPCERQI, Line 3 Incorrect syntax near the keyword 'UNION'.
And we should use UNION ALL for the best plan, because it doesn't sort our data.