1
tavg intデータ型列のnull値に対して 'no data'を出力しようとしていますが、 "then sum((tmin + tmax)/ 2)"の部分になります。どんな助け?すべての戻り値の型が同じである必要があります場合はvarchar値 'string'をデータ型intに変換するときに変換を取得できません
select
Case
when (tavg > -59 and tmin is NULL and tmax is NULL) then tavg
when (tavg > -59 and tmin is NULL and tmax > -59) then tavg
when (tavg is null and tmin >-59 and tmax > -59) then sum((tmin+tmax)/2)
when (tavg is null and tmin is null and tmax is null) then 'No data'
else cast(tavg as varchar(50)) end as 'avg_temp',
case
when tmin is null then 'No data' else cast(tmin as varchar(50)) end as 'Minimum Temperature',
落とし穴の感謝を。 – robot