0

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 ?

Jishad P
  • 703
  • 2
  • 9
  • 24
  • Are you getting any error while running the query ? can you explain what is the OR case you mentioned ? – ArtisanBay Nov 20 '15 at 07:27
  • @Jishad P can you please tell me which records you want to be in the output ( specify the emp_eual_id s ) – Kanishka Panamaldeniya Nov 20 '15 at 07:44
  • well, if you are unsure on laravel queries, try to use [query log](http://laravel.com/docs/4.2/database#query-logging) but you had to activate it for [laravel 5](http://stackoverflow.com/questions/27753868/how-to-get-the-query-executed-in-laravel-5-dbgetquerylog-returning-empty-arr). However, there are tools - which i didn't try yet - like [laravel debugbar](https://github.com/barryvdh/laravel-debugbar). – Bagus Tesa Nov 20 '15 at 11:38

0 Answers0