Re: Get count(*) inside SELECT
Is this what you mean?
SELECT
customerID,
SUM( If( notr=10,1,0) ) as invCount,
SUM( Case WHEN notr = "10" THEN t1.value Else 0 End) invoiceValue,
SUM( Distinct If( notr=16,1,0) ) as creditCount,
SUM(Case WHEN notr = "16" THEN t1.value Else 0 End) creditValue
FROM table
GROUP BY customerID;
Subject
Written By
Posted
Re: Get count(*) inside SELECT
October 02, 2020 10:03AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.