This MS SQL case when snippet
SELECT invoice ,
case
when isnull(sum(tr.cramount),0)>isnull(sum(tr.dramount),0) then isnull(sum(tr.cramount),0)-isnull(sum(tr.dramount),0)
else 0
end as cr,
case
when isnull(sum(tr.dramount),0)>isnull(sum(tr.cramount),0) then isnull(sum(tr.dramount),0)-isnull(sum(tr.cramount),0)
else 0
end as dr
FROM transactions AS tr INNER JOIN accounts AS ac ON tr.DRID
= ac.id inner join accounts ac1 on tr.crid=ac1.id group by invoice,tr.drid
- How to run HugginFace models in Python
- Fix Panda dataframe errors for Backtrader
- How to load an image in Keras from url ?
- Get predicted class in Keras Sequential Model
- Python : list to tuple
- Python SQlite – insertion with tuples and List
- How to extract keys from json object in Python
- Install Python pip and setup tools on openSUSE
- How to import posts from WordPress to Pelican blog
- How to pass python list to JavaScript in Flask app