Click to See Complete Forum and Search --> : reorder statement


jpratt
02-22-2008, 03:10 PM
I have a list of videos on a site. when a user clicks on a video I want to have that id be first then have the remaining ids follow it. So if i have five rows in my db with ids 1-5 and the user clicks the 3rd video, it reorders the playlist 3, 4, 5, 1, 2. How would I do this with a sql statement?

chazzy
02-22-2008, 05:24 PM
you could use a union to get two results..


select whatever from your_table where id >= @id
union
select whatever from your_table where id < @id


Although the behavior on this might be different from one system to another.