返されるケースステートメントを書く必要があります
“1 of 3” if someone voted in one of three elections,
“2 of 3” if someone voted in two of three elections,
“3 of 3” if someone voted in three of three elections,
問題は、値の一部が varchar であり、一部が null であり、それらを一緒に追加できないことです。これは私の考えですが、私はそれを機能させることができません。
select
id,
CASE
WHEN race1 + race2 + race3 = 0 then '0-3'
WHEN race1 + race2 + race3 = 1 then '1-3'
WHEN race1 + race2 + race3 = 2 then '2-3'
WHEN race1 + race2 + race3 = 3 then '3-3'
WHEN race1 + race2 + race3 is null then 'Unknown'
END AS General_Turnout
from test4