mysql - How to used select join with specify any fields in laravel5 -
i want to select 3 table join in laravel5 first times me
public function getjd($id){ $result = []; $result = journaldetail::select('journal_detail.*, jdid journal_detail, jdj_id journal_detail.journal_id .............,tranid transactions_requiry,..............') ->join('journal_requiry','journal_requiry.id','=','journal_detail.journal_id') ->leftjoin('transactions_requiry','transactions_requiry.id','=','journal_requiry.tran_id') ->where('journal_detail.journal_id','=',$id)->get(); return $result; }
errors,
queryexception in connection.php line 624: sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'as `as` `tb_journal_detail` inner join `tb_journal_requiry` on `tb_journal_' @ line 1 (sql: select `tb_journal_detail`.* `as` `tb_journal_detail` inner join `tb_journal_requiry` on `tb_journal_requiry`.`id` = `tb_journal_detail`.`journal_id` left join `tb_transactions_requiry` on `tb_transactions_requiry`.`id` = `tb_journal_requiry`.`tran_id` `tb_journal_detail`.`journal_id` = 26)
but can't don't know how in laravel5. please help
put db::raw(
after select query be:
$result = journaldetail::select(db::raw('journal_detail.*, jdid journal_detail, jdj_id journal_detail.journal_id .............,tranid transactions_requiry,..............')) ->join('journal_requiry','journal_requiry.id','=','journal_detail.journal_id') ->leftjoin('transactions_requiry','transactions_requiry.id','=','journal_requiry.tran_id') ->where('journal_detail.journal_id','=',$id)->get();
Comments
Post a Comment