sql - SqlSyntaxErrorException in DB2 query -


i trying execute following db2 query, i'm getting error:

sqlsyntaxerrorexception: db2 sql error: sqlcode=-119, sqlstate=42803, sqlerrmc=entitlement

the query is:

select * reclaimbalance rb     ,user_benefit_accrued_period ubap rb.user_id = ubap.user_id     , rb.component_id = ubap.pay_head_id     , ubap.customer_id = 281     , rb.year = '2016-2017'     , ubap.status = 1 group ubap.user_id     ,ubap.pay_head_id having sum(ubap.std_balance_added_in_period) != rb.entitlement 

one problem select *. expect error bit different generic syntax error, though.

also, should learn use explicit join syntax. and, having clause has unaggregated column.

i assume want this:

select ubap.user_id, ubap.pay_head_id, rb.entitlement,        sum(ubap.std_balance_added_in_period) reclaimbalance rb join      user_benefit_accrued_period ubap       on rb.user_id = ubap.user_id , rb.component_id = ubap.pay_head_id ubap.customer_id = 281 , rb.year = '2016-2017' , ubap.status = 1 group ubap.user_id, ubap.pay_head_id, rb.entitlement having sum(ubap.std_balance_added_in_period) <> rb.entitlement; 

Comments