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 2000 Forums
 Transact-SQL (2000)
 Difference between two select statements

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-07-10 : 09:09:35
Sachin writes "I my stored procesure I have two different select statements executed on same table (with differenc where clause) Now I want to drop the common rows seletec by both the stored procedure and arrive at unique row set for the two select statements"

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-10 : 09:12:32
You mean you want the rows that are in one or the other but not both?

select .....
union all
select .....
group by all the columns.
having count(*) = 1

or you want all the rows but only once
select .....
union
select .....


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -