Inserting from a SELECT but changing one column?

You can use temporary tables

Create Temporary table

CREATE TEMPORARY TABLE temp_table AS (SELECT * FROM MyTable WHERE ...);

Update column

UPDATE temp_table SET column='Value' WHERE ...;

Or drop a column

ALTER TABLE temp_table DROP column_name;

Insert to destination table

INSERT INTO MyDestinationTable SELECT * FROM temp_table;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)