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 |
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2013-04-11 : 11:03:00
|
i have tableA where already did the total count with the country:tableA:ID TotalSold Blue Red Code1 10 5 5 ABC2 3 2 13 40 30 104 15 5 10 DEFi have another tableB which store the total amount of COde:tableB:Code TotalABC USD89DEF USD90But when i try to inner join the code the total Sold will only appear with the code as below:ID TotalSold Blue Red Code Total1 10 5 5 ABC USD894 15 5 10 DEF USD90How can i appear all as below:?ID TotalSold Blue Red Code Total1 10 5 5 ABC USD892 3 2 13 40 30 104 15 5 10 DEF USD90 |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-04-11 : 11:20:14
|
Do a LEFT JOIN instead of INNER JOIN with the tableA on the left side (first table) and tableB on the right side (second table)select a.*,b.Totalfrom TableA a left join TableB b on a.Code=b.Code |
|
|
|
|
|