$data = DB::table('MASTER_TABLE_NAME as r') ->select('r.*') ->whereExists(function ($query) { $query->select(DB::raw(1)) ->from('CHILD_TABLE_NAME') ->whereRaw('CHILD_TABLE_NAME.ORDER_NO = MASTER_TABLE_NAME.ORDER_NO') ->whereRaw('CHILD_TABLE_NAME.PRDMD_NO <> 0'); //This means not equal to 0 use = if //you want equal value }) ->where('r.UNIT_NO', $org_id) ->where('r.PM_ID', $_SESSION['section']);