Sorting UNION queries with Laravel 4.1

前端 未结 5 1308
后悔当初
后悔当初 2020-12-19 09:44

I think there is something changed in the union between Laravel 4 and Laravel 4.1. I have 2 models.

$pho         


        
5条回答
  •  没有蜡笔的小新
    2020-12-19 10:28

    You can try with DB::query() like below:

    DB::query('(Select id,name,created_at from photos) 
               union 
               (Select id,name,created_at from videos) order by created_at ASC');
    

    I guess as of know it will work. Still looking for actual solution!

提交回复
热议问题