samedi 11 février 2017

Laravel: unable to build multiple orWhere query with laravel query builder

I am trying to make this query with laravel query builder but i did not understand how i can do this:

Query

select * from `data_table_1486794412` where (`column_2` = '2014' or `column_2` = '2015') and (`column_1` = 'GNDU')

My Code is:

$dbObj =  DB::table($datatableName->dataset_table);
$dbObj->orWhere('column_2','2015');
$dbObj->orWhere('column_2','2015');
$dbObj->where(array('column_1','GNDU'));

Laravel Generating Query:

select * from `data_table_1486794412` where `column_2` = ? or `column_2` = ? and (`column_1` = ?)

My Table

data_table_1486794412



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kgddTq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire