INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_manage_stock', 'yes' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_manage_stock');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_stock', '' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_stock');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_price', '' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'wholesale_customer_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'wholesale_customer_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'wholesale_customer_17_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'wholesale_customer_17_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'wholesale_customer_0_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'wholesale_customer_0_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_initial_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_initial_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'sync_with_erp', 'N' FROM 8k3sW1_posts WHERE post_type='product' AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'sync_with_erp');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_manage_stock', 'yes' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_manage_stock');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_stock', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_stock');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_price', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_regular_price', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_regular_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, '_sale_price', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_sale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'wholesale_customer_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'wholesale_customer_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'wholesale_customer_17_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'wholesale_customer_17_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'wholesale_customer_0_wholesale_price', '' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'wholesale_customer_0_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT DISTINCT post_parent, '_initial_wholesale_price', '' FROM 8k3sW1_posts WHERE post_parent > 0 AND post_parent NOT IN (SELECT DISTINCT post_id FROM 8k3sW1_postmeta WHERE meta_key = '_initial_wholesale_price');
INSERT INTO 8k3sW1_postmeta (post_id, meta_key, meta_value) SELECT ID, 'sync_with_erp', 'N' FROM 8k3sW1_posts WHERE post_type='product_variation' AND post_parent > 0 AND ID NOT IN (SELECT post_id FROM 8k3sW1_postmeta WHERE meta_key = 'sync_with_erp');
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='_price' AND D.meta_key='_price' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='_regular_price' AND D.meta_key='_regular_price' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='_sale_price' AND D.meta_key='_sale_price' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='_stock' AND D.meta_key='_stock' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='_stock_status' AND D.meta_key='_stock_status' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='sync_with_erp' AND D.meta_key='sync_with_erp' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103891 SET D.meta_value=S.meta_value WHERE S.meta_key='sync_months_lowest_price' AND D.meta_key='sync_months_lowest_price' AND D.post_id=104441;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='_price' AND D.meta_key='_price' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='_regular_price' AND D.meta_key='_regular_price' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='_sale_price' AND D.meta_key='_sale_price' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='_stock' AND D.meta_key='_stock' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='_stock_status' AND D.meta_key='_stock_status' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='sync_with_erp' AND D.meta_key='sync_with_erp' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103892 SET D.meta_value=S.meta_value WHERE S.meta_key='sync_months_lowest_price' AND D.meta_key='sync_months_lowest_price' AND D.post_id=104442;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='_price' AND D.meta_key='_price' AND D.post_id=104443;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='_regular_price' AND D.meta_key='_regular_price' AND D.post_id=104443;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='_sale_price' AND D.meta_key='_sale_price' AND D.post_id=104443;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='_stock' AND D.meta_key='_stock' AND D.post_id=104443;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='_stock_status' AND D.meta_key='_stock_status' AND D.post_id=104443;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='sync_with_erp' AND D.meta_key='sync_with_erp' AND D.post_id=104443;
UPDATE 8k3sW1_postmeta D INNER JOIN 8k3sW1_postmeta S ON S.post_id=103893 SET D.meta_value=S.meta_value WHERE S.meta_key='sync_months_lowest_price' AND D.meta_key='sync_months_lowest_price' AND D.post_id=104443;
