0

below is my query...

    DB::table('sometable')
    ->join('sometable','sometable.ID','=','manytable.ID')
    ->where('manytable.SBPlan','00')
    ->where('manytable.NetStatus','0')
    ->select()->get();

for the above query i need one more condition

    ->where('manytable.Status','00')
    ->where('manytable.Status','21')

if manytable.Status==00 or manytable.Status==21 then select.. how do we fix this? i have already tried

    ->orwhere('manytable.Status','00')
    ->orwhere('manytable.Status','21')

but did got a wrong result...

Phill Sparks
  • 18,310
  • 3
  • 31
  • 45
Friend
  • 1,246
  • 10
  • 38
  • 60

1 Answers1

0
->where('manytable.SBPlan','00')
->where('manytable.NetStatus','0')
->where(function ($query) {
    $query->where('manytable.Status','00')
      ->orWhere('manytable.Status','21');
    })

reference - Laravel 4 eloquent WHERE with OR AND OR? / Laravel or where

Community
  • 1
  • 1
Sougata Bose
  • 30,871
  • 8
  • 44
  • 87