I am trying to delete all rows from table1 that have a matching PK in table2. I am getting error 1175 though my WHERE clause is using a Key. I'm familiar with toggling the safe mode but this should not be an issue as again my WHERE clause does contain the Private Key for both tables. Any suggestions to resolve would be greatly appreciated. Further details below.
table1 structure:
CREATE TABLE `table1` (
`pkfield` varchar(10) NOT NULL,
`field1` varchar(3) DEFAULT NULL,
`field2` varchar(1) DEFAULT NULL,
`field3` varchar(1) DEFAULT NULL,
PRIMARY KEY (`pkfield`),
UNIQUE KEY `pkfield_UNIQUE` (`pkfield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
table2 stucture:
CREATE TABLE `table2` (
`pkfield` varchar(10) NOT NULL,
PRIMARY KEY (`pkfield`),
UNIQUE KEY `pkfield_UNIQUE` (`pkfield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Delete Query:
DELETE table1.*, table2.* FROM table1 INNER JOIN table2
WHERE table1.pkfield=table2.pkfield;
Action Output Response:
Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect.
Thank you.