SQL Svr 2000
I have the following select statement:
I would like to incorporate into the select portion an additional field based upon the following criteria.
Can anyone offer some guidance?
I have the following select statement:
Code:
Select ac.Client, ag.Name, t.TxDate, v.PdAmt, p.Payor, v.CoPay, b.BillNum, b.AjDate, v.RPaySeq
From Payments v
inner join AClient ac on v.ClientNum = ac.ClientNum
inner join Provider ag on ac.ProvNum = ag.ProvNum
left join FundingSource p on v.FSID = p.FSID
inner join BDetail bd on v.BDID = bd.BDID
left join Bill b on bd.BLID = b.BLID
inner join Treat t on bd.TxID = t.TxID
Where bd.Status = 2 --Paid
and b.Adjd = 1 --Adjudicated
and ag.ProvNum = 111
I would like to incorporate into the select portion an additional field based upon the following criteria.
Code:
(IF v.PdAmt < 0
Then 'Void'
If v.RpaySeq = 99
Then 'Reallocate'
Else 'none' ) as 'AdjustType'
Can anyone offer some guidance?