I have this Query:
SELECT
COUNT(x.dwActualNumberOfDoffings) AS 'DoffCount'
,x.sRecipeName AS 'Denier'
,SUM(Shift_Weight) AS 'Shift_LBS'
,SUM(Shift_Length) AS 'Shift_Meters'
FROM
(
SELECT
dwActualNumberOfDoffings
,sRecipeName
,CASE
WHEN sRecipeName = '1385 denier' THEN (42000)
WHEN sRecipeName = '1411 Denier' THEN (31500)
WHEN sRecipeName = '1426 Denier' THEN (38000)
WHEN sRecipeName = '1700 Denier' THEN (26000)
ELSE NULL
END 'Shift_Length'
,CASE
WHEN sRecipeName = '1385 denier' THEN (14.2)
WHEN sRecipeName = '1411 Denier' THEN (10.9)
WHEN sRecipeName = '1426 Denier' THEN (13.9)
WHEN sRecipeName = '1700 Denier' THEN (10.8)
ELSE NULL
END 'Shift_Weight'
FROM BitWinder_1_LH
WHERE dwActualNumberOfDoffings >= 1
AND t_stamp BETWEEN '2022-07-01 08:00:00' AND '2022-07-31 20:00:00'
) AS x
GROUP BY x.sRecipeName
And it returns this:
I am trying to have the Columns that have NULL return a value based off a calculation, something like this: (if denier = 1411 then doffcount * 10.8 = shift_lbs) Im just not sure how to input it into the query.
Any help would be great.