hey allemaal,

Ben nu al een tijdje bezig met een mysql command in elkaar te steken, maar ik geraak niet echt vooruit.

Wat moet er gebeuren?

Adcount_input is de data die in de tabellen moet verwerkt worden.
Dit door de data in de verschillende tabbellen te verzamelen.





Tabel afkortingen:
Table Names:
Adcount_input AS [color=green]AI[/color]
shop_product_attribute AS [color=red]PA[/color]
shop_product_attribute_combination AS [color=blue]PAC[/color]
shop_stock_available AS [color=purple]SA[/color]

1 (zie afbeelding 1) [color=green]AI[/color].ean13 = [color=red]PA[/color].ean13 (bijvoorbeeld: TrekT80J15)

2 (zie afbeelding 1) [color=green]AI[/color].id_soort = [color=blue]PAC[/color].id_attribute (bijvoorbeeld: 35)

3 (zie afbeelding 1) [color=green]AI[/color].id_framemaat = [color=blue]PAC[/color].id_attribute (bijvoorbeeld: 11)

4. Count(*) rows die overblijven

5. UPDATE [color=purple]SA[/color] SET [color=purple]SA[/color].quantity = count WHERE [color=red]PA[/color].id_product = [color=purple]SA[/color].id_product AND [color=red]PA[/color].id_product_attribute = [color=purple]SA[/color].id_product_attribute

dit is het eerste gedeelte als iemand mij hier mee kan helpen kan ik proberen het tweede gedeelte zelf verder op te lossen zodat ik een werkende voorbeeld heb.

alvast bedankt!
waar ik momenteel al zit:

<?php
$get_input = "UPDATE shop_stock_available s
JOIN (

SELECT p.ean13, p.id_product_attribute, p.id_product, c.id_attribute, c.id_product_attribute, COUNT(*) amount 
FROM shop_product_attribute p, shop_product_attribute_combination c

    JOIN Adcount_input a ON p.ean13 = a.ean13  AND c.id_product_attribute = p.id_product_attribute
    GROUP BY p.id_product_attribute, p.ean13) q
    USING (id_product_attribute) SET s.quantity = q.id_attribute_product"; 	
$result_input = mysql_query($get_input) or die(mysql_error());
while($input_row = mysql_fetch_array($result_input)) {	}
?>


update:
het probleem zit vooral in hoe prestashop id_attribute verwerkt
zowel id 35 (= Dame) als id 11(45 CM) zitten onder de noemer id_attribute
waardoor ik altijd een false bericht krijg als ik probeer te zoeken of alle data aanwezig is.

2 (zie afbeelding 1) AI.id_soort = PAC.id_attribute (bijvoorbeeld: 35)
3 (zie afbeelding 1) AI.id_framemaat = PAC.id_attribute (bijvoorbeeld: 11)

Reageren