Im looking to add all products that dont have attribute_id = 12 into oc_product_attribute,
But getting a syntax error…
1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’12) select ocp.product_id from oc_product ocp where ocp.product_id not in (SE’ at line 1
insert into `oc_product_attribute` (ocp.product_id, 12)
select ocp.product_id from oc_product ocp where ocp.product_id not in (SELECT oca.`product_id`
FROM `oc_product_attribute` oca where oca.attribute_id = 12)
Am I missing something here, quite new to SQL.
Usually you have to enumerate columns in
insertstatements.must be
and I guess it may be
attribute_id.For more details, please see the reference manual -> http://dev.mysql.com/doc/refman/5.6/en/insert-select.html