SELECT a.nid, a.stock, b.qty, sum( b.qty )
FROM uc_product_stock a
INNER JOIN uc_order_products b ON a.nid = b.nid
GROUP BY a.nid
the above query give me the following result:
nid stock qty sum(b.qty)
10 746 1 4
11 256 4 11
now i want to insert this in my custom table. For eg, the structure of custom table is:
id | orderIn | orderOut
10 | 746 | 4
11 | 256 | 11
Iam using this query, but it gives error:
insert into custom (id, OrderIn, OrderOut)
select
a.nid,
a.stock,
b.qty,
sum(b.qty)
from
table1 a inner join table2 b on a.id=b.id
group by a.id

idandskurelated? Is sku allways 'sku-'+id ? – Stuart Moore Feb 4 at 11:55