Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help writing query

Author  Topic 

michaelgr
Starting Member

9 Posts

Posted - 2009-09-04 : 04:20:49
Hello,

I write a query (combine of 2 queries using UNION):

query1
UNION
query2

I want the result of query 2 (there is only one result in query2) will be placed in the last row of the results of the big query.
I mean the results of query1 will be in the first rows and the result of the query2 will be in the last row.
How can i do it?

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-09-04 : 04:27:46
Hi Try like this

select *,0 AS rid from table1
union
select *,1 as rid from table2
order by rid
Go to Top of Page
   

- Advertisement -