jeudi 19 novembre 2015

Laravel Query Builder select a column with multiple values

I have four arrays and a one variable like below.

$jptypes = ["26","27"]

$jvalues = ["57","62"]

$jbranches = ["33","63"]

$jstream = ["2","2"]

$jmarks = 10

I want to collect employees with those matching arrays and value.

 $empsarr = DB::table('otc_employee_qualifications')
            ->whereIn('emp_qualifctn_type',$jptypes)
            ->whereIn('qualification_value',$jvalues)
            ->whereIn('emp_qualifctn_branch',$jbranches)
            ->whereIn('emp_qualifctn_stream',$jstream)
            ->where('qualification_mark','>=',$jmarks)
            ->distinct()
            ->lists('employee_id');

  return $empsarr;

enter image description here

But whereIn method will not checking both values. its in OR case.

I want to check both the values in the array at once.

how can i solve this issue ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire