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
 General SQL Server Forums
 New to SQL Server Programming
 Set Logic help

Author  Topic 

learntsql

524 Posts

Posted - 2010-03-05 : 09:34:21
Hi All,
I have two result sets let say Set A and Set B,
The eliments in set A are 1,2,4 and in set B are 2,3,4.
My requirement is to display the eliments which are non mapped.

i.e Output should be
1,3

TIA.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-05 : 09:39:18
Post the code that procedures two resultsets

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 09:43:24
do you mean this?

(resultset1

except
resultset2)
union
(resultset2
except
resultset1)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

learntsql

524 Posts

Posted - 2010-03-05 : 09:50:42
Yes, but should repeat result sets 4 times.
Is there any other way doing this or should i follow this.
plz. guide me.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 09:52:08
quote:
Originally posted by learntsql

Yes, but should repeat result sets 4 times.
Is there any other way doing this or should i follow this.
plz. guide me.


results sets 4 times how?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

learntsql

524 Posts

Posted - 2010-03-05 : 10:00:47
I mean before union it evaluates result1 and resultset2
and after union it evaluates result2 and resultset1.
correct me if i am wrong.
quote:
Originally posted by visakh16

do you mean this?

(resultset1

except
resultset2)
union
(resultset2
except
resultset1)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-05 : 10:02:53
Did you see my first reply?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 10:06:23
then use temp tables to hold them and use them in my suggestion instead

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -