0

MySQL select 的时候怎样排除某一列不显示

jacqueline created at5 years ago view count: 3437

select的出来的复制为insert语句,不想要primary key主键这些。

report
回复
1
# 提换下users, 和test_db即可
SET @sql =  (select CONCAT('SELECT ', (SELECT REPLACE(GROUP_CONCAT(COLUMN_NAME), 'id,', '') FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'users' AND TABLE_SCHEMA = 'test_db'), ' FROM  users'));

PREPARE stmt FROM @sql;
EXECUTE stmt;
5 years ago 回复

相关搜索关键词