select
case
when
(
(
case
when 字段1 is
null
then 1
else
0 end) +
(
case
when 字段2 is
null
then 1
else
0 end) +
(
case
when 字段3 is
null
then 1
else
0 end) +
(
case
when 字段4 is
null
then 1
else
0 end) +
(
case
when 字段5 is
null
then 1
else
0 end) +
(
case
when 字段6 is
null
then 1
else
0 end) +
(
case
when 字段7 is
null
then 1
else
0 end) +
(
case
when 字段8 is
null
then 1
else
0 end)
) <= 1 then
"完善度80%以上"
when
(
(
case
when 字段1 is
null
then 1
else
0 end) +
(
case
when 字段2 is
null
then 1
else
0 end) +
(
case
when 字段3 is
null
then 1
else
0 end) +
(
case
when 字段4 is
null
then 1
else
0 end) +
(
case
when 字段5 is
null
then 1
else
0 end) +
(
case
when 字段6 is
null
then 1
else
0 end) +
(
case
when 字段7 is
null
then 1
else
0 end) +
(
case
when 字段8 is
null
then 1
else
0 end)
) >=5 then
"完善度50%以下"
else
"完善度80%以下"
end as zzs
from 表A