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.
Can Anybody explain why I am getting error like this while running the below code
""""
select * from (select TOP 1 CITY,len(CITY) from STATION ORDER BY len(CITY),CITY) UNION select * from (select TOP 1 CITY,len(CITY) from STATION ORDER BY len(CITY) DESC,CITY ASC);
""""
ERROR:
Msg 156, Level 15, State 1, Server dbrank-tsql, Line 6
Incorrect syntax near the keyword 'UNION'.
Msg 102, Level 15, State 1, Server dbrank-tsql, Line 6
Incorrect syntax near ';'.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 5
You are viewing a single comment's thread. Return to all comments →
Can Anybody explain why I am getting error like this while running the below code """" select * from (select TOP 1 CITY,len(CITY) from STATION ORDER BY len(CITY),CITY) UNION select * from (select TOP 1 CITY,len(CITY) from STATION ORDER BY len(CITY) DESC,CITY ASC);
"""" ERROR: Msg 156, Level 15, State 1, Server dbrank-tsql, Line 6 Incorrect syntax near the keyword 'UNION'. Msg 102, Level 15, State 1, Server dbrank-tsql, Line 6 Incorrect syntax near ';'.