Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> SQL Question - Summing and Grouping
I'm new to SQL, but I do have some programming background. I have two questions.
I need to create a report that sums the cost savings for hospital patients and groups the cases into dollar ranges. The ranges are
<=$2,000
$2,001 - $4,000 $4,001 - $6,000 $6,001 - $8,000 $8,001 - $10,000
The output should look like:
Cases with $2,000 or less in cost savings Pat4 1824
Cases with $2,001 - $4,000 in cost savings Pat3 3948
Cases with $4,001 - $6,000 in cost savings
Pat1 4634
Pat2 5472
I've got my report so that it sums the figures for each patient, but I'm doing that through the report form, which is preventing me from subsequently grouping the cases into the given dollar ranges. Is there a way through SQL to sum the cost savings on each case, then group the cases into the required dollar ranges?
Any help you can offer will be greatly appreciated!
--Tom
Sent via Deja.com
http://www.deja.com/
Received on Thu Feb 01 2001 - 14:54:26 CST