I have two tables with identical structure except for one column... Table 2 has that additional column in which i would insert the CURRENT_DATE()
I would like to cop
SET @sql =
CONCAT( 'INSERT INTO (',
(
SELECT GROUP_CONCAT( CONCAT('`',COLUMN_NAME,'`') )
FROM information_schema.columns
WHERE table_schema =
AND table_name =
AND column_name NOT IN ('id')
), ') SELECT ',
(
SELECT GROUP_CONCAT(CONCAT('`',COLUMN_NAME,'`'))
FROM information_schema.columns
WHERE table_schema =
AND table_name =
AND column_name NOT IN ('id')
),' from WHERE = ' );
PREPARE stmt1 FROM @sql;
execute stmt1;
Of course replace <> values with real values, and watch your quotes.