#列名
select COLUMN_NAME from information_schema.columns 
where TABLE_SCHEMA='yunpiaobox_db' and table_name='t_announcement'


#列名字符串 按,分隔  
select 
GROUP_CONCAT(COLUMN_NAME separator ',') '逗号分隔',
GROUP_CONCAT(CONCAT('OLD.', COLUMN_NAME) separator ',') 'OLD.字段     逗号分隔', 
GROUP_CONCAT(CONCAT('NEW.', COLUMN_NAME) separator ',') 'NEW.字段     逗号分隔', 
GROUP_CONCAT(CONCAT(COLUMN_NAME, '=NEW.', COLUMN_NAME) separator ',') '字段=NEW.字段 逗号分隔' 
from information_schema.columns 
where TABLE_SCHEMA='yunpiaobox_db' and table_name='t_shops'

 

posted on 2018-06-14 10:06  1161588342  阅读(679)  评论(0编辑  收藏  举报