Reputation: 553
I am running this query in HIVE 0.12
select X.PERS_KEY, Y.*, sum(Y.PAID_AMT, Y.DEDUCT_AMT) AS CHRG_AMT, sum(Y.PAID_AMT, Y.DEDUCT_AMT, Y.CHRG_VAL) AS CHRG_AMT2
from MEMBERS X
LEFT JOIN
(select PERS_KEY, CLM_KEY, DIAG_CD, PAID_AMT, DEDUCT_AMT, CHRG_VAL from clm_table where DIAG_CD < 10) Y
ON X.PERS_KEY=Y.PERS_KEY
I'm sure the issue is with the sum() functions in the outer query, but I'm not sure why it is an issue. Why can't we simply take some variables in a row and create a new variable that is the sum of them?
Upvotes: 0
Views: 9623
Reputation: 49260
sum
function takes exactly one argument. You should use Y.PAID_AMT + Y.DEDUCT_AMT
if you need to sum up those values.
Upvotes: 3