Select rows in random order and then reverse it
Posted
by
Faruz
on Stack Overflow
See other posts from Stack Overflow
or by Faruz
Published on 2011-01-09T15:29:51Z
Indexed on
2011/01/09
17:54 UTC
Read the original article
Hit count: 197
sql-server-2005
I need to select rows in random order and return a query which holds the rows in both regular order and in reverse order. This is done to simulate a fantasy draft for a basketball game I'm working on.
For example, I need a result set as followed:
team1 1
team2 2
team6 3
team9 4
team9 5
team6 6
team2 7
team1 8
As you can see, the first four teams are random then then following four are in reverse order. Hope I managed to explain the problem, if not - please comment and I'll explain further.
© Stack Overflow or respective owner