0
union
select max(r.departcoding) as coding,r.depart as depart,sum(-i.amount) as amount,sum(-i.amount*i.price) as price,0 as goodsAmount2,0 as goodsPrice2,0 as goodsAmount3,0 as goodsPrice3,0 as goodsAmount4,0 as goodsPrice4 from
ReturnGoodsRecord r,ReturnGoodsItem i where r.id = i.returngoodsrecord_id
and r.type = '一次性物品' $P!{returnGoodsSql} group by r.depart
)endTable group by endTable.depart order by coding asc]]>