Alle Hauptartikel deaktivieren anhand eines Kriteriums in der „details“ Tabelle
1 2 3 4 5 |
-- Ein SELECT zum testen SELECT * FROM `s_articles` WHERE `id` IN ( SELECT `articleID` FROM `s_articles_details` WHERE `ordernumber` LIKE 'DS%'); -- Das update UPDATE `s_articles` SET `active` = 0 WHERE `id` IN ( SELECT `articleID` FROM `s_articles_details` WHERE `ordernumber` LIKE 'DS%'); |
1 2 |
-- Alle Artikel aus der Detailtabelle holen eines bestimmten suppliers SELECT * FROM `s_articles_details` WHERE `articleID` IN (SELECT id FROM `s_articles` WHERE `supplierID` = 10) |
1 2 3 4 5 |
-- Alle Artikel eines suppliers deaktivieren UPDATE `s_articles` SET `active` = 0 WHERE `supplierID` = 10; -- Alle Details eines bestimmten suppliers deaktivieren UPDATE `s_articles_details` SET `active` = 0 WHERE `articleID` IN (SELECT id FROM `s_articles` WHERE `supplierID` = 10) |