No. The whole underlying theory of relational databases is that location of data is irrelevant - it's the contents of the data that count. Consequently, it really doesn't matter which row you're inserting into - you can select, update, and delete by providing information about what you are looking for.
No way that I'm aware of (well, OK, it can be done but it's ugly:
SELECT val FROM my_table WHERE val=1
UNION ALL
SELECT val FROM my_table WHERE val=4
.
.
. )
If you need to display in the order you gave, then you would probably have to create a separate column that, when sorted, results in the display you gave. For instance, your table might look like:
sort_col display_col
1 1
4 2
5 3
2 4
3 5
Then, the query
SELECT display_col FROM my_table ORDER BY sort_col
would give you the desired results.
A case statement could be used to create a temp file for the expressed purpose of sorting.
Select
table1.field1, table1.field2, (CASE table1.field1 when '1' then '1' when '2' then '4' when '3' then '5' when '4' then '2' when '5' then '3' END)
from
table1
order by 3;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.