dimanche 21 août 2022

fetch maximum column row in laravel

I have this table structure

id |  user_id  |   sequence_id  |  test_id

1       11             1            4
2       11             3            4
3       11             9            4
4       11            10            4

..
..
20      11             18           4

i want to fetch the maximum sequence_id that exist for particular user, using this query

test::where('test_id', $request->id)->orderBy('sequence_id', 'DESC')->get();

but getting 9th sequence id but it should return 18

Any solution Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire