I have a query and those items that return null I need to make them a 0 and add the unit to it as well (g, mL) which comes from the DefaultContainerSizeUnit table. Any help is greatly appreciated
Here is the query:
SELECT i.ItemName, (CAST(SUM( CASE WHEN VolumeOrNumber IS NULL THEN 0 WHEN AdjustmentTypeID = 1 THEN VolumeOrNumber WHEN AdjustmentTypeID = 2 THEN VolumeOrNumber *-1 END) AS VARCHAR(10))) + ' ' + u.Abbreviation AS InventoryTotal FROM Item i LEFT JOIN Inventory v ON i.ItemID = v.ItemID LEFT JOIN DefaultContainerSizeUnit u ON i.DefaultContainerSizeUnitID = u.DefaultContainerSizeUnitID GROUP BY i.ItemName, u.Abbreviation ORDER BY i.ItemName
Returns:
ItemName InventoryTotal
------------------------------ ---------------------
Equipment 1 NULL
Filet Mignon 13.00 g
Hydrocodone 0.00 g
Unit 1 NULL
Valium 0.00 mL
X-Ray NULL