Order by sequence number in ascending, positioning NULL value at last (order by id ascending)
SELECT * FROM picrure ORDER BY -sequence DESC, id ASC;
Given example: picture table
id
sequence
name
1
NULL
picture_one
2
1
picture_two
3
2
picture_three
4
NULL
...
Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts