select - SQL Specific Item on top -
i having query photo contest:
select * `users` order entry_id desc
the result gives 10 records entry_id 10, 9, 8, 7, ......1
what can pick specific entry on top? there requirement if there refer id, entry show first.
so expected result should be: 4,10,9,8,7,6,5,3,2,1 if 4 if refer id.
try this:
select * `users` order (case when entry_id = 4 0 else 1 end), entry_id desc;
Comments
Post a Comment