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.
| Author |
Topic |
|
karthi2009
Starting Member
23 Posts |
Posted - 2009-11-10 : 02:43:50
|
| Hi,I have two tables as below:Table 1:--------------------Items | Qty (Sold)--------------------Item-1 | 3Item-2 | 4Item-4 | 7====================Table 2:--------------------Items | Qty (Remaining)--------------------Item-1 | 5Item-2 | 6Item-4 | 10====================I want to show results as follows:----------------------------------------Items | Qty (Sold) | Qty (Remaining)----------------------------------------Item-1 | 3 | 5Item-2 | 4 | 6Item-4 | 7 | 10========================================Please guide me in this regard,Thanks in advance,Karthikeyan |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-11-10 : 02:45:37
|
| why you want to use UNION?A simple join can do it for you.PBUH |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-11-10 : 02:49:02
|
select t1.item,t1.soldt2.remainingfrom table1 t1left join table2 t2 on t2.items = t1.items No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|