Hi there,
Im trying to change a section of a select SQL statement in an SSRS report. Currently it says
WHEN 60 = ISNULL ((select top 1 CurrentProcessStepID FROM dbo.itTransactionProcess
WHERE AssetID = a.AssetID order by transactionid desc), 0)
THEN 'Harvest for Parts'
ELSE 'Recycle'
The issue here is that its assuming that every time the top result in the itTransaction process table for NextProcessStepID would be null. In practice, this isn't the case. what i need is for my statement to check to see if NextProcessStepID is null and if it is then use CurrentprocessstepID to make the decision and if it isnt NUll then we can use NextProcessStepID to make the call.
I tried something like below and couldn't get it quite right.
iif(tp.NextProcessStepID=Null, (select top 1 CurrentProcessStepID FROM...
↧
SQL reporting statement question
↧