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
  • 20,000
  • 3
  • 33
  • 46
Friend
  • 1,326
  • 11
  • 38
  • 62

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
  • 31,517
  • 8
  • 49
  • 87