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
)
DB::table(DB::raw("({$query->toSql()}) as alias") )
1AVG(SUM(amount))
Code Example |
---|
Sql :: sqlalchemy query join many to many |
Sql :: sql ignore |
Sql :: function in sql |
Sql :: t sql return on letters only |
Sql :: fatal error uncaught mysqli_sql_exception |
Sql :: how to close external sql connection in laravel |
Sql :: what is 1=2 in sql |
Sql :: sql update subtract value |
Sql :: create table |
Sql :: sorting desc in sql |
Sql :: primary key with prefix sql |
Sql :: store date time in mysql |
Sql :: Sql Text or Varchar |
Sql :: insert sql |
Sql :: triggers db |
Sql :: decimal to integer sql |
Sql :: primary key auto increment in postgresql |
Sql :: constraint sql |
Sql :: casterar postgres |
Sql :: SQL Syntax of RIGHT JOIN |
Sql :: install sql |
Sql :: hierarchal database table |
Sql :: sql int +1 |
Sql :: how to save result of sqlite query in a table |
Sql :: sql run online |
Sql :: copy data from cell to cell mysql |
Sql :: how to use multiple transactions in sql server |
Sql :: sort by last two number sql |
Sql :: java check if something is in mysql table |
Sql :: SQL Hello, [firstname] [lastname] |