Hi there,
I have this sql
select distinct epstransactions.PatientID, sum(epstransactions.LedgerAmount)
from epstransactions
inner join EPSReferralKPIs on epstransactions.PatientID = EPSReferralKPIs.dbPatID
group by epstransactions.PatientID
order by patientid
Whilst selecting distinct patientID's I also wish to create a posAmount and NegAmount from the LedgerAmount column as well
eg
ID Tot Neg Pos
56867 100 -200 300
56868 0 -300 300
56869 -100 -300 200