Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Any query specialist? you have a challenge

Re: Any query specialist? you have a challenge

From: <Stephen.Broberg_at_gmail.com>
Date: 4 Apr 2006 11:31:47 -0700
Message-ID: <1144175507.273836.61400@j33g2000cwa.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US