Level 102
Well first of you arent passing anything to distict
DB::table('items')->select('items_to_list.user_id', 'items.item_code')
->distinct('items_to_list.user_id')
->leftJoin('items_to_list','user_id', '=', 'items.id')
->where('items_to_list.status', '=', 0)
->where('items.deleted', '=', 0)
->whereIn('items_to_list.list_id', [10, 20])->pluck('items_to_list.user_id')->toArray();
1 like