Using a case statement to pull minuimum number
Posted on 2005-04-26
I hope I can explain this -- and don't know if it's even possible -- but here goes:
I have a statement
SELECT CONVERT(VARCHAR(15), CONVERT(MONEY, JobID) / 100) AS JobNo,
CASE WHEN ((ResourceID in ('4', '42', '5', '6', '8', '44', '45', '12', '13') AND
TranType = 'O')) THEN (Qty) ELSE '0' End
but instead of returning all lines for the ResourceIDs, I'd like to have it return a single line per JobId with the Minimum Qty -- and throwing a min in front of the QTY doesn't seem to work.