a guest Mar 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- CREATE TABLE products (
- product_id INT(11) PRIMARY KEY AUTO_INCREMENT,
- product_desc VARCHAR(250) NOT NULL UNIQUE,
- imagesrc VARCHAR(250)
- CONCAT('INSERT INTO products (product_id, product_desc) VALUES (', @rownum, ',\'', product_id, '\');') AS sql_stmt,
- CONCAT('UPDATE local set product_id = ', @rownum, ' WHERE product_id = \'', product_id, '\';') AS sql_stmt,
- @rownum := @rownum + 1
- DISTINCT product_id
- WHERE product_id IS NOT NULL
- AND product_id <> ''
- ) AS tbl
- ,(SELECT @rownum := 1) r;
- ALTER TABLE `local` CHANGE `product_id` `product_id` INT(11) NOT NULL;
RAW Paste Data