I have the following query....
UPDATE vehicle_catalog SET parent_id = 0 WHERE parent_id = SUBSTR(id, 0, 5)
I need to set all parent_id
s to 0 where the first 5 characters of id is the same as the parent_id. This is effecting 0 rows when I'm looking at the data and it should be effecting over 10,000.
Any ideas on why this wouldn't be effecting all rows?
UPDATE
What I don't understand if I did
UPDATE SET col = '1'
it would effect the whole database, yet my query isn't run on the whole database.
UPDATE The proper solution:
UPDATE `vehicle_catalog` SET parent = 0 WHERE SUBSTRING(id FROM 1 FOR 6) == SUBSTRING(parent_id FROM 1 FOR 6)