我应该如何在laravel中执行此sql查询?我从一开始就遇到了问题。
select buy.buyer,buy.buysum,sale.seller,sale.salesum,buy.buysum + sale.salesum as "Total" from
(select buyer,sum(amount) as "buysum" from tbl
group by buyer) buy
inner join
(select seller,sum(amount) as "salesum" from tbl
group by buyer) sale
on buy.buyer=sale.seller
order by total DESC
limit 5