This is a query, how to select the top from the result? This is for SQL Server.
SELECT column1 FROM table WHERE column2 = 'Whatever' AND column3 = 'Sure' UNION SELECT column4 FROM table WHERE column2 = 'Whatever' AND column3 = 'Sure'
Try the following:
SELECT TOP 1 * FROM ( SELECT column1 FROM table WHERE column2 = 'Whatever' AND column3 = 'Sure' UNION SELECT column4 FROM table WHERE column2 = 'Whatever' AND column3 = 'Sure' ) R ORDER BY Column1
Try:
SELECT max(Column) FROM ( SELECT column1 as Column FROM table WHERE .... UNION SELECT column4 as Column FROM table WHERE .... )
You mean
SELECT TOP 1 * FROM ( SELECT column1 FROM table WHERE column2 = 'Whatever' AND column3 = 'Sure' UNION SELECT column4 FROM table WHERE column2 = 'Whatever' AND column3 = 'Sure')