Log in

View Full Version : I need to delete all data in a single field from 300 tables


Kaibito
2015-12-19, 10:50 PM
I have an ecommerce store that I am currently working on and there are approx 300 products which have a field named "product_id" at www.prescription-glasses.com database.

These fields contains an old product_id that I need to delete altogether.

How can I create a query that will replace all "product_id" fields with data in them with a null value?

Lakeville
2015-12-19, 10:53 PM
This will set every product_id to NULL which is currently not null.

UPDATE table_name
SET product_id= NULL
WHERE product_id is not null;