I want to customize my order by , if the Qty is negative then that row must be in fist then if the Qty is positive I will sort it by ExpDate
SELECT WhsCode,
ItemCode,
LotNumber,
ExpDate,
Qty
FROM rq_Test2
ORDER BY CASE
WHEN qty < 0 THEN Qty
ELSE ExpDate
END
But I am getting an error of " Arithmetic overflow error converting expression to data type datetime. " .. Why ?
Thanks ..