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

Home -> Community -> Usenet -> c.d.o.misc -> More SQL counting questions...

More SQL counting questions...

From: Marco Shaw <marco_at_Znbnet.nb.ca>
Date: Fri, 05 Aug 2005 14:50:45 GMT
Message-ID: <91LIe.70460$Ph4.2192229@ursa-nb00s0.nbnet.nb.ca>


I have a table that looks like this:

server_name severity log_only notification_only

--------       --------  --------    ----------
serverA        critical    0             0
serverA        critical    1             0
serverA        major     1             1
serverB        major     0             0

Actually from above, critical is actually represented as an 8, and major as a 32 in the actual table(I've figured out how to change using decode to something more meaningful like critical/major in the resulting report).

I want to create a report something like:

server_name no of messages critical_messages major_messages log_only notification_only

---------       ---------------   ----------------    ---------------    ---
----    ---------------
serverA        3                       2                           1
2             1
serverB        1                       0                           1
0            0

I know how to produce a report on the first 2 columns, and last 2 (using simply SUM), but since I have to decode and count the middle 2 columns, I'm not sure how to report on these middle 2 columns. Alternatively, I could SUM on some lines, like critical for example, but the result of the SUM would have to be divided by 8 before being outputted to the report.

Any guidance would be appreciated. I hope the above is clear...

Marco Received on Fri Aug 05 2005 - 09:50:45 CDT

Original text of this message

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