CREATE TEMPORARY TABLE tmp SELECT * FROM sitelog WHERE 1=1; ALTER TABLE tmp DROP COLUMN `ID`; INSERT INTO sitelog SELECT 0, tmp.* FROM tmp; DROP TEMPORARY TABLE tmp;