mardi 16 mars 2021

get the required data from table

I have the table with fields id,before_value,after_value.I have the array value for parent_id ('11')

I want to get the value in below constraints

  1. before value is OIN and after value is MGL
  2. after value is MGL and before value is not OIN and parent id is in my array ('11','18');

3 before value is MGL and after value is MQL

enter image description here

I have tried as

$audit_table_result=$audit_table_result->orWhere(function ($query) use ($meeting_ids){
            return $query->where('after_value_string','=','MGL')->whereNotIn('before_value_string',['OIB'])->whereIn('parent_id',['11','18']);
             })->orWhere(function ($query) {
            return $query->where('before_value_string','=','MGL')
           ->where('after_value_string','=','MQL');
             })->orWhere(function ($query) {
            return $query->where('before_value_string','=','OIB')
           ->where('after_value_string','=','MGL');
             })->where('parent_id',$added_id)   
            ->get();

I expected to get the id 1,3,4,5 but I'm getting 1,2,3,4,5,6



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire