如何在laravel 4.2中编写这个sql命令

时间:2015-08-04 17:34:36

标签: php sql laravel

我正在尝试使用Laravel 4.2运行此查询,但我不确定如何实现它。任何人都可以给我指向正确的方向吗?谢谢!

select * from (select * from `t_quotation_revises` ORDER BY id DESC) AS x GROUP BY `t_quotation_id`

1 个答案:

答案 0 :(得分:0)

select * from(select * from t_quotation_revises ORDER BY id DESC)AS x GROUP BY t_quotation_id

上面的查询将在laravel 4.2中编写,如:

$ reviseQuotationArr = DB :: table(DB :: raw('(select * from t_quotation_revises ORDER BY id DESC)AS x'))                                      - > GROUPBY( 't_quotation_id')                                      - >得到();