Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Any query specialist? you have a challenge
You're close, you just have your logic reversed. Put the sums around
the case statements, instead of inside them, and only group by
customer, like this:
SELECT CustNo
, sum(case when (...) between 1 and 3 then NoOfOrders else 0 end)
One2Three
, etc.
FROM testTable
GROUP BY CustNo;
Received on Tue Apr 04 2006 - 13:31:47 CDT