nik_slick Posted December 10, 2010 Share Posted December 10, 2010 Hello there! I am more or less a newbie when it comes to MySQL. So please have patience. We have a webshop where all products come from separate suppliers with a script that automatically unpublishes products that the supplier no longer has in it's offer. However, as we have several suppliers, running one script will un-publish all others and also the products that we have locally (which in turn might have been discontinued by supplier, but since we have them, we wish to sell them). What we have done now, is added an attribute to the system with a code for the supplier. However, I can't get the code to work. The original code which updated all products no matter what works, but I need help inserting the final bit. This is the code that works. It creates a table with sku inserted from three variables. $updateunpublished = "INSERT INTO unpublished SELECT sku FROM catalog_product_entity WHERE entity_id NOT IN ( SELECT entity_id FROM catalog_product_entity_varchar WHERE value = 0 AND attribute_id = 947) AND sku NOT IN ( SELECT item FROM csvupdate) AND sku NOT IN ( SELECT sku FROM unpublished);"; What I need is to insert a new variable that checks the supplier is correct, otherwise it should not include that product in the un-publish list. The attribute_id is "xxx" and the value should be "bbb" and the table it should pick it from is catalog_product_entity_int. I am completely lost, as I am a newbie at this. The code above was done by someone else and it's probably dead easy. Anyone - help... //Nik Quote Link to comment https://forums.phpfreaks.com/topic/221211-problem-with-sql-select-code-help/ Share on other sites More sharing options...
fenway Posted December 10, 2010 Share Posted December 10, 2010 I'm not sure what you want us to do with that statement. Quote Link to comment https://forums.phpfreaks.com/topic/221211-problem-with-sql-select-code-help/#findComment-1145525 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.