Quote:
Originally posted by orange
Hi there;
Got a little problem I can't work out.
Want to select all the row's from my table, but order the results starting at a particular row [which is defined by a user]. i.e.
Rows in table
1
2
3
4
5
6
Want to select all rows but starting from row 5 giving me:
5
6
1
2
3
4
Thanks in advance
|
SELECT columnName, IF(columnName >= start, columnName - start, columnName + start) as myorder
FROM tableName
ORDER BY myorder
In your example, just replace start with 5 in the above query
SELECT columnName, IF(columnName >= 5, columnName - 5, columnName + 5) as myorder
FROM tableName
ORDER BY myorder
Hope this helps.