vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| select number,name,age,address from people where number in (88,4,2,6,8,1,166,33) How I make this to have order by exact numbers as in query. I want result to be ordered like this: 88 4 2 6 8 1 166 33 and not 1 2 4 ......etc and not by name or anything else How to do this ? Thank you |
| |||
| On 16 May, 09:55, Aahz <juno10...@hotmail.com> wrote: > select number,name,age,address from people > where number in (88,4,2,6,8,1,166,33) > > How I make this to have order by exact numbers as in query. I want > result to be ordered like this: > > 88 > 4 > 2 > 6 > 8 > 1 > 166 > 33 > > and not > > 1 > 2 > 4 > .....etc > > and not by name or anything else > > How to do this ? Thank you SELECT `number`, `name`, `age`, `address` FROM `people` WHERE `number` IN (88,4,2,6,8,1,166,33) ORDER BY FIND_IN_SET(`number`,'88,4,2,6,8,1,166,33') |
| ||||
| Thank you Captain ! Captain Paralytic je napisao: > On 16 May, 09:55, Aahz <juno10...@hotmail.com> wrote: > > select number,name,age,address from people > > where number in (88,4,2,6,8,1,166,33) > > > > How I make this to have order by exact numbers as in query. I want > > result to be ordered like this: > > > > 88 > > 4 > > 2 > > 6 > > 8 > > 1 > > 166 > > 33 > > > > and not > > > > 1 > > 2 > > 4 > > .....etc > > > > and not by name or anything else > > > > How to do this ? Thank you > > SELECT > `number`, > `name`, > `age`, > `address` > FROM `people` > WHERE `number` IN (88,4,2,6,8,1,166,33) > ORDER BY FIND_IN_SET(`number`,'88,4,2,6,8,1,166,33') |