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 |
Phaswana
Starting Member
1 Post |
Posted - 2013-05-23 : 17:47:22
|
i have table A and B such that A(1,2,3,4,5) and B(1,1,1,1,1,1,2,2,3,5,5,5,6,6). now I want to count the number of items in A that exists in B including the ones that don't exists in B then show them as table C such that C(1=6,2=2,3=1,4=0)how can i do this?PM Malatjie |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-23 : 18:02:48
|
[code]select a.col, count(b.col)from a left join b on a.col = b.colgroup by a.col;[/code] |
|
|
philipcarter99
1 Post |
Posted - 2013-06-11 : 05:17:37
|
Hi ,i had the same query where i couldn't find exact code ..really loved it ..Thank u guys for posting this solution .unspammed |
|
|
|
|
|
|
|