Created
May 13, 2019 16:17
-
-
Save JesusLeon/5a87e38195a48690606b961c094dfac2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$article_supplier = Shopware()->Db()->fetchAll("SELECT a.id article, s.name supplier FROM s_articles a, s_articles_vote av, s_articles_supplier s WHERE a.id = av.articleID AND s.id = a.supplierID GROUP BY (av.articleID)"); | |
foreach ($article_supplier as $a_s) { | |
$sql = "UPDATE `s_articles_vote` | |
SET | |
`supplierName` = '" . $a_s['supplier'] . "' | |
WHERE | |
`voteID` = '" . $a_s['article'] . "' | |
"; | |
Shopware()->Db()->query($sql); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE s_articles_vote av | |
INNER JOIN ( | |
SELECT a.id article, s.name supplier FROM s_articles a, s_articles_vote av, s_articles_supplier s WHERE a.id = av.articleID AND s.id = a.supplierID GROUP BY (av.articleID) | |
) AS s | |
SET av.supplierName = s.supplier | |
WHERE av.`articleID` = s.article | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment