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

SQL PROBLEM

$
0
0

why is this not giving me all the rows in the left column?

SELECT I.[DESC], I.ITEM, CAST((I.COST2 - I.COST) / .75 AS DECIMAL(10,2)) AS OUNCES, SUM(A.QTY) AS QTY, (SUM(A.QTY) * CAST((I.COST2 - I.COST) / .75 AS DECIMAL(10,2))) AS [OZ X Sales]  
FROM INV2 I
LEFT OUTER JOIN ARD2 A 
ON I.ITEM = A.ITEM
WHERE I.TYPE = 'TOB' AND I.CLASS = 'MOS' AND A.DATE BETWEEN '2014-1-1' AND '2014-1-31' 
GROUP BY I.[DESC], I.ITEM, I.COST2, I.COST
ORDER BY I.[DESC] 

gives me 57 rows

and 

SELECT * FROM INV2 WHERE TYPE = 'TOB' AND CLASS = 'MOS' 

gives me 104 rows

I would like all 104 rows and whatever data matches to those 104 rows will fill in and whatever data doesn't will just show the data from the inv2 database.


Debra has a question


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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