Joined: 25 Jun 2015
Location: United States
Online Status: Offline
Posts: 8
Topic: Using Command Sum Posted: 29 Apr 2016 at 2:26pm
I'm trying to create a report to display status of work orders. I'm utilizing multiple tables to accomplish this. The INNER JOIN has been most useful for sure! Now where I'm hitting a road block in material inventory. Having the same material designation with multiple heat lots created issues for this report. The sum of the material proved to be difficult in crystal 2011. So I found the SUM command (SQL). This works a real treat actually:
Sum(Material_Location.On_Hand_Qty) AS Inv
My issue though is when I have no material (NULL) the row doesn't display at all. I've tried countless ideas via the web but just can't get the blank null values to display!?
This last Command line works great if there is inventory of material:
SELECT Sum(Material_Location.On_Hand_Qty) AS Inv
FROM Material_Req INNER JOIN Material_Location ON Material_Req.Material=Material_Location.Material
GROUP BY Material_Req.Material
Is this a bigger issue than I realize trying to integrate Command and Table Data?
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Posted: 02 May 2016 at 5:13am
You could put in a case statement into your SQL query.
SELECT CASE WHEN Sum(Material_Location.On_Hand_Qty) IS NULL THEN 0 ELSE Sum(Material_Location.On_Hand_Qty) END AS Inv
FROM Material_Req INNER JOIN Material_Location ON Material_Req.Material=Material_Location.Material
GROUP BY Material_Req.Material
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum