Created
December 1, 2018 17:47
-
-
Save koras/49772e7ca286649519f290b2064812e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SQLSTATE[HY093]: Invalid parameter number | |
// (SQL: select (select `user`.`id` from `user` | |
// where `user`.`id` in (2013, 2015, ?, ?, ?, ?) limit 1) as ff | |
// from `user` as `tmp_user` where `tmp_user`.`year` in (?, ?)) | |
$arrayUser = [5,6,7,8,9,10]; | |
$arrayYear = [2013,2015]; | |
$subSelect = DB::table('user') | |
->select('user.id') | |
->wherein('user.id',$arrayUser) | |
->limit(1) | |
->toSql(); | |
// var_dump($subSelect); | |
$res = DB::table('user as tmp_user') | |
->select( DB::raw('('.$subSelect.') as ff') | |
) | |
->wherein('tmp_user.year',$arrayYear) | |
->get(); | |
var_dump( $res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment