What is wrong with the following T-SQL running in SQL 7.0 against the pubs database?:
Select top 1
4 AS JustANumber, au_id, au_lname, au_fname, state, contract
from authors
where state = 'CA'
order by contract ASC
UNION
Select top 1
5 as JustANumber, au_id, au_lname, au_fname, state, contract
from authors
where state = 'UT'
order by contract ASC
This gives me an error:
Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'UNION'.
If I remove the ORDER BY clause from the first SELECT it runs. But I only want one record returned from each SELECT.
Any ideas?
Bryan
Select top 1
4 AS JustANumber, au_id, au_lname, au_fname, state, contract
from authors
where state = 'CA'
order by contract ASC
UNION
Select top 1
5 as JustANumber, au_id, au_lname, au_fname, state, contract
from authors
where state = 'UT'
order by contract ASC
This gives me an error:
Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'UNION'.
If I remove the ORDER BY clause from the first SELECT it runs. But I only want one record returned from each SELECT.
Any ideas?
Bryan