I have this sql statement and i need to include Rec_Qty and Del_Qty in the where clause how is this possible please
SELECT depot, loadno, partno, quantity,
case when type = 'S' THEN
quantity * -1
ELSE
0.00
END Rec_Qty,
CASE WHEN type <> 'S' THEN
quantity
ELSE
0.00
END Del_Qty
FROM dbo.moves
WHERE depot BETWEEN @DepFrom and @DepTo
AND loadno BETWEEN @LoadFrom and @LoadTo
SELECT depot, loadno, partno, quantity,
case when type = 'S' THEN
quantity * -1
ELSE
0.00
END Rec_Qty,
CASE WHEN type <> 'S' THEN
quantity
ELSE
0.00
END Del_Qty
FROM dbo.moves
WHERE depot BETWEEN @DepFrom and @DepTo
AND loadno BETWEEN @LoadFrom and @LoadTo