I have a custom ordering need like this:
normal ordering | custom ordering
1 | 7
2 | 6
3 | 5
4 | 4
5 | 3
6 | 2
7 | 8
. | .
. | .
. | .
. | .
. | N
N | 1
I have thought about using UNION to combine 3 different select queries with the help of ORDER BY and LIMIT. However, I can not do that because UNION have to be used before ORDER BY and LIMIT.
How can I make a selection (or selections) to achieve the custom ordering above?
Another workaround might help is just make the 1st record returned in this select query the last record, but how?