-
Challenging Question - Need help with Aggregating data in Oracle SQL
I have a CLAIM_LINE table
The CLAIM LINE table has
CLM_NBR
CLM_Line number
ALLOWED_AMT
DEDB_AMT
every CLM_NBR has multiple claim_Line_numbers
I am trying to write a SQL query to display the above two amounts in an aggregated manner such that it will show me
the TOTAL ALLOWED_AMT and TOTAL DEDB_AMT per every CLM_NBR and NOT break it down by CLM_LINE number.
select CLM_NBR,
SUM (ALLOWED_AMT),
SUM(DEDB_AMT)
from CLM_LINE
group bY CLM_NBR
order by CLM_NBR
The above SQL query doesnt seem to help. IT will still break it down by claim number AND claim line number.
I want the subtotals for every CLAIM_number and not CLAIM_LINE number.
Tried ROLL UP command too but didnt help.
Will appreciate any help!!!
I will greatly appreciate your inputs!
-
Your query is correct, since you are grouping by CLM_NBR the SUMs are for CLM_NBR not for CLM_LINE, check your result and data.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|