| Author |
Topic |
|
forum.nasum
Starting Member
4 Posts |
Posted - 2008-04-09 : 12:42:59
|
| Hi,I have 10 rows in my table, it has int as primary key, (Autogen).I need to take rows in my custome format, I can't use desc, asc on existinc column.. I need to provide order by giving a row no. sequence.Can you tell me how to do that?like order by pk (......). |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-09 : 12:47:26
|
| DIdnt get what you're asking for. Can you give some sample data & o/p to make this clear? |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-09 : 12:54:35
|
| How do you propose to assign sequence no. to rows?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
forum.nasum
Starting Member
4 Posts |
Posted - 2008-04-09 : 13:02:34
|
| I mean i need likeTablePK Name1 SRI2 Durga5 Deepa7 KiranI need a select stmtwhere I can get resultSRIDEEPADURGAKIRANSee here.. Order is not on PK Name, its my custom order... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-09 : 13:09:41
|
| What determines the customised order in which you want the result? |
 |
|
|
forum.nasum
Starting Member
4 Posts |
Posted - 2008-04-09 : 13:16:24
|
| I can give that... I will give based on PK - I can give the squence of order ..like Order by PK (1,2,4,..) like this.. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-09 : 13:25:02
|
| You cant give seq like this in order by. I was asking what determines in which order you want output or will the sequence be same always? |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2008-04-09 : 23:20:19
|
| select table.* from tableinner join (select 1 as pk, 1 as orderBy union allselect 5, 2 union allselect 2, 3 union allselect 4, 4)s on (table.pk=s.pk)order by s.orderByor you can create the sort order table as a real table, or you can add sequence number to your table. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-10 : 04:46:50
|
| ororder by case when value='somevalue' then 1 when value='othervalue' 2.... end,valueMadhivananFailing to plan is Planning to fail |
 |
|
|
|