Codice PHP:
SELECT table1.date, table1.orderid, table1.productid,
table1.totale, table1.price_1,
table1.price_2, table1.price_3, table2.productcode
sum(table1.price_1) as totale_price_1,sum(table1.price_2) as totale_price_2,
sum(table1.price_3) as totale_price_3
FROM table1 LEFT JOIN table2 USING (productid) GROUP BY by table2.productcode;
cosa sbaglio?
le due query separate mi funzionano senza problemi
Codice PHP:
select productid, orderid,
sum(price_1) as totale_price_1,
sum(price_2) as totale_price_2,
sum(price_3) as totale_price_3
from table2
group by productid;
Codice PHP:
SELECT table1.date, table1.orderid, table1.productid,
table1.amount, table1.price, table1.price_1,
table1.price_2, table1.price_3, table2.productcode
FROM table1 LEFT JOIN table2 USING (productid);
non riesco a fonderle insieme