Question : laravel where in subquery
Answered by : index-out-of-bounds
DB::table('users') ->whereIn('id', function($query) { $query->select(DB::raw(1)) ->from('orders') ->whereRaw('orders.user_id = users.id'); }) ->get();
This will produce:
select * from users where id in ( select 1 from orders where orders.user_id = users.id
)
Source : https://stackoverflow.com/questions/16815551/how-to-do-this-in-laravel-subquery-where-in | Last Update : Tue, 21 Jun 22
Question : laravel subquery in from clause
Answered by : websiteamz
DB::table(DB::raw("({$query->toSql()}) as alias") )
Source : | Last Update : Wed, 16 Feb 22