SELECT g.id	,g.name,	g.weight,	SUM(t.count) AS total
FROM goods AS g JOIN trans  AS t ON g.id=t.goods_id
WHERE g.weight < 50
GROUP BY id	,name,	g.weight
ORDER BY g.id