Category : distinct

‘variants’ => [‘nullable’, ‘array’], ‘variants.*.name’ => [‘required’, ‘string’], ‘variants.*.options’ => [‘required’, ‘array’, ‘min:1’], ‘variants.*.options.*.code’ => [‘required’, ‘string’, ‘distinct’], I’m having a validation rules above, what I’m trying to achieve is the distinct of the value only for between inner array, but somehow I’m getting error like this with the input input: { variants: [ { ..

Read more

Table List: Here is the SQL as mentioned in the title: SELECT DISTINCT ON (hbg.group_id) hbg.group_id, hbg.id AS id, hbg.group_name, hbg.group_description, hbg.group_type_id, hbgt.group_type_name, hbg.category_id, hbg.effective_start_datetime, hbg.created_by, hbg.created_datetime, hbg.archived_by, hbg.archived_datetime FROM hms_bbr_group hbg LEFT JOIN hms_bbr_group_type hbgt ON hbg.group_type_id = hbgt.group_type_id ORDER BY hbg.group_id, hbg.id DESC; test in pgAdmin: (only selecting distinct id) I am trying ..

Read more

I just want to skip duplicate data from database,My foreign key is repeating so I just want to skip duplicate entry and get latest only My controller is like that $old=DB::table(‘tabl-1’) ->leftJoin(‘tbl-2′,’tabl1.id’,’=’,’tabl2.tabl1_id’) ->whereDate(‘created_at’,'<‘ ,Carbon::today()) ->select(‘tbl1.name as name’,’tbl1.class as class’,’tabl2.table1_id’) ->distinct(‘tabl2.table1_id’) ->get() ->toArray(); Sourc..

Read more