Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

420 Posts

Posted - 04/11/2013 :  11:03:00  Show Profile  Reply with Quote
i have tableA where already did the total count with the country:

ID TotalSold Blue Red Code
1 10 5 5 ABC
2 3 2 1
3 40 30 10
4 15 5 10 DEF

i have another tableB which store the total amount of COde:

Code Total

But when i try to inner join the code the total Sold will only appear with the code as below:

ID TotalSold Blue Red Code Total
1 10 5 5 ABC USD89
4 15 5 10 DEF USD90

How can i appear all as below:?

ID TotalSold Blue Red Code Total
1 10 5 5 ABC USD89
2 3 2 1
3 40 30 10
4 15 5 10 DEF USD90

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 04/11/2013 :  11:20:14  Show Profile  Reply with Quote
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.Total
from TableA a left join TableB b on
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000