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
 UNION ..

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-07-24 : 11:45:54
Hi
just so im certain the UNION operator in SQL is the
same as in Mathematics correct ??

I have 3 unions in an SQL select, pt 1 on its own
gives 121,353 rows
pt 2 : 13743
pt 3 : 2119

but the UNION of the 3 gives 19780 !!!!

It should be at least 121,353 !!! ..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-24 : 11:49:01
quote:
Originally posted by pazzy11

Hi
just so im certain the UNION operator in SQL is the
same as in Mathematics correct ??

I have 3 unions in an SQL select, pt 1 on its own
gives 121,353 rows
pt 2 : 13743
pt 3 : 2119

but the UNION of the 3 gives 19780 !!!!

It should be at least 121,353 !!! ..




UNION takes union of queries and gives back distinct values out of them so if you have duplicate values in those queries then total records will be less. You can use UNION ALL if you dont want to take distinct of results. it just returns union of all the queries.
Go to Top of Page
   

- Advertisement -