select g.goods_id,g.goods_name ,g.selling_price ,g.cost_price ,COUNT(g.goods_id),SUM(t.trading_number)from goods g,trading_information t where g.goods_id=t.trading_goods_id GROUP BY g.goods_id这老师很low啊,有点罗嗦,代码也不精简,bean写一个profit就行了,sql如上一条就行了,反正自己改了好多。