0
あいまいですは参加:列への参照は、私がCONT_IDパラメータで2つのテーブルに参加したい
select (case when age_years >= 18 and age_years < 30 then '18-29'
when age_years < 50 then '30-49'
when age_years < 70 then '50-69'
when age_years < 100 then '70-100'
end) as age_range,
count(DISTINCT CONT_ID) as num,
SUM(ACAUT)/COUNT(*) as avg
from CLIENT c
left join PAYTB t
on c.CONT_ID = t.CONT_ID
group by (case when age_years >= 18 and age_years < 30 then '18-29'
when age_years < 50 then '30-49'
when age_years < 70 then '50-69'
when age_years < 100 then '70-100'
end)
order by min(age_years);
エラーが
SQLCODE = -203、ERROR:COLUMNのCONT_ID TO REFERENCEは曖昧である
代わりに 'count(DISTINCT c.CONT_ID)'を実行してください。 – jarlh
'count(DISTINCT CONT_ID)as num'を使って、テーブル(' c'または 't')...' count(DISTINCT c.CONT_ID)をnumまたは ' count(DISTINCT t.CONT_ID)as num –
これで結合が固定されました。 – bastel