anti43
nicht mehr wegzudenken
Hi,
Ich steh grad aufm SQL Schlauch, eventuell kann mir ja hier jemand weiterhelfen..
Ich habe 2 Tabellen, vereinfacht dargestellt:
und
nun möchte ich eine Abfrage erstellen, welche als Ergebnismenge folgendes enthält.. pseudocode:
ich weiss irgendwie nicht, wie ich das count() in ne join Abfrage reinbekomme ..
select productid, quantity, count(sold_items.productid) from stock left outer join sold_items ???
Danke schonmal,
Gruß Andreas
Ich steh grad aufm SQL Schlauch, eventuell kann mir ja hier jemand weiterhelfen..
Ich habe 2 Tabellen, vereinfacht dargestellt:
PHP:
stock:
productid | quantity
und
PHP:
sold_items:
productid
nun möchte ich eine Abfrage erstellen, welche als Ergebnismenge folgendes enthält.. pseudocode:
PHP:
productid | quantity | count(productid in sold_items)
1 | 32 | 543
etc
ich weiss irgendwie nicht, wie ich das count() in ne join Abfrage reinbekomme ..
select productid, quantity, count(sold_items.productid) from stock left outer join sold_items ???
Danke schonmal,
Gruß Andreas