jeudi 7 juin 2018

make the display order based on another table value

I have two tables request and status_tracker. I want to list the row in top which has only one entry in status tracker.

I have the query in $user=DB::table('request')->select('request.*)->get();

I want to add the order based on status_tracker table.if request_id has count '2' in status_tracker table I want to display in top of the table

 $user=DB::table('request')->select('request.*)(order may happend here)->get();

if ID 19,11,15 has 2 count in status_tracker it should display first and rest of them will display below as 19,11,15,18,17,16,14,13,12,10.

Is it possible by order the row based on another table field count in laravel



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire