|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Order by
Hi,I have a little problem and i dont know how to solve it.
I have a query that returns a list of names that are always the same ones,for example: 'Literature' 'Mathematics' 'Science' 'Chemistry' ... My problem is that i want to order this result just like i wrote it,so i can't use order by that column. Anyone know a way to that? Thanks! |
|
#2
|
|||
|
|||
|
Please have a look at the rownum function as in:
select rownum, owner, table_name from all_tables Cheers, Dan |
|
#3
|
|||
|
|||
|
You might be better off by looking at the address of each row.
Please try: 1) select rowid from your_table; 2) select rowidtochar(rowid) from your_table; 3) select rowidtochar(rowid) from your_table order by rowidtochar(rowid); Cheers, Dan |
|
#4
|
|||
|
|||
|
Code:
order by case subject when 'Literature' then 1 when 'Mathematics' then 2 when 'Science' then 3 when 'Chemistry' then 4 end If you have a version that does not support case expressions, you can use the decode function. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Order by |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|