Если ваша версия поддерживает ее, вы можете использовать сгенерированные столбцы https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html, например,
DROP TABLE IF EXISTS T;
create table t(id int auto_increment primary key,gw int,ww int, fs int
,category varchar(100) as (
case
when gw = 1 and ww = 1 and fs = 1 then 'gw,ww,fs'
when gw = 1 and ww = 1 then 'gw,ww'
when gw = 1 and fs = 1 then 'gw,fs'
when gw = 1 and fs = 1 then 'gw,fs'
when ww = 1 and fs = 1 then 'ww,fs'
when gw = 1 then 'gw'
when ww = 1 then 'ww'
when fs = 1 then 'fs'
else null
end
)
);
insert into t (gw,ww,fs) values
(1,1,1),
(1,1,0),
(1,0,0),
(0,1,1),
(0,0,1),
(1,0,1);
select *,
case
when gw = 1 and ww = 1 and fs = 1 then 'gw,ww,fs'
when gw = 1 and ww = 1 then 'gw,ww'
when gw = 1 and fs = 1 then 'gw,fs'
when gw = 1 and fs = 1 then 'gw,fs'
when ww = 1 and fs = 1 then 'ww,fs'
when gw = 1 then 'gw'
when ww = 1 then 'ww'
when fs = 1 then 'fs'
else null
end cat
from t;
+----+------+------+------+----------+----------+
| id | gw | ww | fs | category | cat |
+----+------+------+------+----------+----------+
| 1 | 1 | 1 | 1 | gw,ww,fs | gw,ww,fs |
| 2 | 1 | 1 | 0 | gw,ww | gw,ww |
| 3 | 1 | 0 | 0 | gw | gw |
| 4 | 0 | 1 | 1 | ww,fs | ww,fs |
| 5 | 0 | 0 | 1 | fs | fs |
| 6 | 1 | 0 | 1 | gw,fs | gw,fs |
+----+------+------+------+----------+----------+
6 rows in set (0.00 sec)
update t set gw = 0 where id = 1;
+----+------+------+------+----------+-------+
| id | gw | ww | fs | category | cat |
+----+------+------+------+----------+-------+
| 1 | 0 | 1 | 1 | ww,fs | ww,fs |
| 2 | 1 | 1 | 0 | gw,ww | gw,ww |
| 3 | 1 | 0 | 0 | gw | gw |
| 4 | 0 | 1 | 1 | ww,fs | ww,fs |
| 5 | 0 | 0 | 1 | fs | fs |
| 6 | 1 | 0 | 1 | gw,fs | gw,fs |
+----+------+------+------+----------+-------+
Я оставлю вас работать с перестановками gw, ww, fs