不确定这里发生了什么......我知道这与max和group by语句有关...任何帮助都非常感谢!
select
c_clm as ClaimNo,
i_pol as Policy,
d_rcv_clm as Received,
c_sta_clm as Status,
d_tmn_clm as Terminated,
c_tmn_clm as Reason,
MAX(pym.d_rls_pym) as Payment,
c_sgm as Segment
from ltc_p.VLTC_CLM_WK clm
left join pearl_p.TLTC915_PYM pym on
clm.i_sys_clm = pym.i_sys_clm
where c_sgm = 'am'
group by 1,2,3,4,5,6,7,8
答案 0 :(得分:1)
你的第七栏是:
MAX(pym.d_rls_pym)
你不能这样分组。将您的group by子句更改为:
group by c_clm, i_pol, d_rcv_clm, c_sta_clm, d_tmn_clm, c_tmn_clm, c_sgm
我将数字更改为列名,因为大多数数据库不支持group by中的引用号。你可以做同样的事情:
group by 1, 2, 3, 4, 5, 6, 8
答案 1 :(得分:-1)
糟糕
分组1,2,3,4,5,6,8
修正了它。