Mysql 触发器 A表记录到B表

Posted 1161588342

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql 触发器 A表记录到B表相关的知识,希望对你有一定的参考价值。

1:查询出需要的列名 备用

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

 

TABLE_SCHEMA: 数据库名称    table_name:表名


#列名字符串 按,分隔
select
GROUP_CONCAT(COLUMN_NAME separator \',\') \'逗号分隔\',
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_box_status\'

 

2:工具Navicat Premium 右击A表  ---> 设计表 --->  选择触发器

 

以上是关于Mysql 触发器 A表记录到B表的主要内容,如果未能解决你的问题,请参考以下文章