Ich habe zwei Tabellen und beide table2
und table3
können einen Betrag für die key
von Tabelle1 enthalten.MySQL SUM Werte aus 2 Tabellen und JOIN
Ich möchte diese Werte zusammenfassen und sie als amount
darstellen.
SELECT table1.mg_key
, table1.mg_name
, table1.time
, table2.mg_amount + table3.mg_amount amount
, table2.mg_key + table.mg_key
FROM table
LEFT
JOIN table2
, table3
ON table1.mg_key = key
AND key = amount
Es funktioniert nicht, also mache ich wahrscheinlich etwas falsch?
Lesen Sie die [Join] (http://dev.mysql.com/doc/refman/5.7/en/join.html) -Syntax, dann schauen Sie genau hin, was Sie tun (falsch). –
meinst du 'von table1' .... mach einfach nicht beitritt so ist das so 1996 – Drew
@Drew Ja' table1'. Nun, ich fand ein Tutorial, das es so gemacht hatte ... – Borsn