获取表中所有字段
select column_name from information_schema.columns where table_schema='dbo' and table_name=‘sy_sitem'
将某个字段下的值拼接成一个字符串:
select GROUP_CONCAT(字段名 SEPARATOR '连接符') from table;
值替换:
SELECT `id`,
case
`user_state`
when 1 then '11'
when 2 then '22'
when 3 then '33'
else 'no'
end as `user_state`
FROM `表名`