Codice PHP:
SELECT table1.datetable1.orderidtable1.productid,
table1.totaletable1.price_1,
table1.price_2table1.price_3table2.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 
(productidGROUP BY by table2.productcode
cosa sbaglio?

le due query separate mi funzionano senza problemi

Codice PHP:
select productidorderid,
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.datetable1.orderidtable1.productid,
table1.amounttable1.pricetable1.price_1,
table1.price_2table1.price_3table2.productcode
FROM table1 LEFT JOIN table2 USING 
(productid); 
non riesco a fonderle insieme