Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Can't Get The Right Join

$
0
0

I have two tables (terrible data architecture I know...) One table itemsShipped one table itemsDamaged.  I need to get a count of item from itemsDamaged in my query, but when I use an Inner Join (or an outer, or a left, or a right) I keep getting inaccurate results.  Below is my query...

Select
a.item, COUNT(b.item)
From itemsShipped a
Inner Join itemsDamaged b
On a.ID = b.ID 
GROUP BY a.item, b.item
Order By a.item ASC


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>