Hello everyone!
I've run into a little snag with SQL (which I am still very new at). What I'm trying to do it run a query again medical claim information and return only claims where the total is over $1,000. There can be multiple lines per claim
i.e.:
CLAIM_ID, PAY_AMT
1, 1000
2, 50
2, 50
3, 900
3, 100
Here is the query:
When I run this, it gives me this error:
Any ideas as to what I'm doing wrong?
Thanks!
I've run into a little snag with SQL (which I am still very new at). What I'm trying to do it run a query again medical claim information and return only claims where the total is over $1,000. There can be multiple lines per claim
i.e.:
CLAIM_ID, PAY_AMT
1, 1000
2, 50
2, 50
3, 900
3, 100
Here is the query:
Code:
SELECT MBR_NUM, CLAIM_ID, SUM(PAY_AMT) AS SUMOF_PAY_AMT FROM CLAIM WHERE SUMOF_PAY_AMT > 1000.00 GROUP BY MBR_NUM, CLAIM_ID
Code:
ERROR [42S22][IBM][CLI Driver][DB2] SQL0206N "SUMOF_PAY_AMT" is not valid in the context where it is used. SQLSTATE=42703
Thanks!
Comment