January 6, 2010 at 9:50 am
Hi all,
Let say there are two select statement and we are using UNION to combine result from both select statement.
Now the problem lies here:
Let say that first select statement returns these rows
ColumnA
A
A
B
C
And second select statement return these rows
ColumnB
B
C
D
D
Now can any one please tell me what will be the result of the query where we are using union between those above select statements.
Thanks
Rajneesh
January 6, 2010 at 9:58 am
The result will be ABCD (ie four rows with an implicit distinct from the union, or you could use union all if you do not want the implied distinct.
Not sure I understand why it is a problem though...
Mike
January 7, 2010 at 7:39 pm
...and if you don't want to remove the duplicates, use UNION ALL rather than UNION.
January 7, 2010 at 10:40 pm
The answer is ABCD
as union remove all the duplicate values
if You want to retain all values please use UNION ALL 🙂
January 7, 2010 at 10:47 pm
kiranbgiet (1/7/2010)
The answer is ABCDas union remove all the duplicate values
if You want to retain all values please use UNION ALL 🙂
Thank you for your valuable contribution 😛
January 7, 2010 at 10:59 pm
To OP - not to sound harsh but pls lookup BOL and then ask your doubts. A Few doubts can be cleared by checking BOL.
Hope my comments will be appreciated.
"Keep Trying"
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply