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)
 Unions

Author  Topic 

misterraj
Yak Posting Veteran

94 Posts

Posted - 2005-01-20 : 07:03:17
I have one record in table#1 which contains
-------------------------
order_num|sub_order_num|
-------------------------
and 2 records in table#2 and 13 records in table#3 and these records also have order_num and suborder_num as their primary keys and they need to be simply clubbed.

i.e., i need to get 1 record + 2 records +13 records

I used union all where i was getting 1*2*13 records

how do i solve it. ?

RM
Yak Posting Veteran

65 Posts

Posted - 2005-01-20 : 07:12:57
Post the query that you are using.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-01-20 : 07:56:33
[code]SELECT order_num, sub_order_num
FROM table#1
UNION ALL
SELECT order_num, sub_order_num
FROM table#2
UNION ALL
SELECT order_num, sub_order_num
FROM table#3
[/code]
should give you 1+2+13

Kristen
Go to Top of Page
   

- Advertisement -