| Author |
Topic |
|
ranjeetsingh_6
Posting Yak Master
125 Posts |
Posted - 2007-05-07 : 03:39:45
|
| Hii want records nither Assending nor Decending order.I want in that order which is exist in query.For example of given query i want output as belowQuery:-SELECT txtgr_noFROM tbltGRWHERE txtgr_no IN ('139198', '139194', '139197', '139195', '139196')My Desire OUTPUT(As it is order which given in query):-txtgr_no--------------------139198139194139197139195139196Ranjeet Kumar Singh |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-07 : 03:46:18
|
| [code]SELECT txtgr_noFROM tbltGR gJoin(Select '139198' as txtgr_no, 1 as rank union allSelect '139194', 2 union allSelect '139197', 3 union allSelect '139195', 4 union allSelect '139196', 5 ) ton g.txtgr_no = t.txtgr_noorder by t.rank[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-05-07 : 03:58:47
|
| SELECT txtgr_noFROM tbltGRWHERE txtgr_no IN (139198, 139194, 139197, 139195, 139196)order by txtgr_no % 4 + txtgr_no % 5 + txtgr_no % 8 DESC, txtgr_no % 23 DESCPeter LarssonHelsingborg, Sweden |
 |
|
|
ranjeetsingh_6
Posting Yak Master
125 Posts |
Posted - 2007-05-07 : 03:59:42
|
| Thanks to You.Ranjeet Kumar Singh |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2007-05-07 : 04:10:24
|
| [code]order by txtgr_no % 4 + txtgr_no % 5 + txtgr_no % 8 DESC,txtgr_no % 23 DESC[/code]This is somthing new to me, what is the logic of this??Chiraghttp://chirikworld.blogspot.com/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-05-07 : 04:14:51
|
| None. But it fits the original question.I can't see the reason to have the records returned in that fashion. If the poster already knows which records to fetch, he would know in which order to sort them at client (front end) application.Peter LarssonHelsingborg, Sweden |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2007-05-07 : 04:21:44
|
| Aha.. I See.. but i beliave this is not the first post with this kind of requirement..!!Chiraghttp://chirikworld.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-07 : 08:49:27
|
quote: Originally posted by Peso None. But it fits the original question.I can't see the reason to have the records returned in that fashion. If the poster already knows which records to fetch, he would know in which order to sort them at client (front end) application.Peter LarssonHelsingborg, Sweden
Will that fit to all data?MadhivananFailing to plan is Planning to fail |
 |
|
|
|