select id,name,weight,tatol
from goods as g,
(select goods_id,sum(count) as tatol from trans group by goods_id) t
where g.id = t.goods_id and tatol>20 and weight <50
order by id;
select id,name,weight,tatol
from goods as g,
(select goods_id,sum(count) as tatol from trans group by goods_id) t
where g.id = t.goods_id and tatol>20 and weight <50
order by id;