Forums

This topic is locked

SQL SORT PROBLEM

Posted 09 Sep 2003 02:11:08
1
has voted
09 Sep 2003 02:11:08 asp1 asp1 posted:
I have a table calles STATUS, only 3 options can go into this,

Available
Accepted Offer
In Contract

my problem is i want to sort it by that exact order, not alphabetical i want ORDER BY status then those 3 options in the same order as they are?? anyone know how??

Thanks

Replies

Replied 17 Sep 2003 17:23:58
17 Sep 2003 17:23:58 Julio Taylor replied:
Erm.

Can you post the SQL for your table and a little more explanation of what you would likle to achieve? Maybe i can write you a query, your problem doesn't seem complicated but i need more info.

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 17 Sep 2003 18:32:21
17 Sep 2003 18:32:21 asp1 asp1 replied:
Hey thansk for the reply,i actually sorted it out the next day, but maybe you might know of a better way. I have a table called "STATUS" Only 3 value can go in there and they are "Available" "Accepted Offer" and "in Contract" the problem i had was the sort order, ORDER BY STATUS but this will only list them alphabeticaly, what if i want a specific order??

like instead of 1, 2, 3 what if i want 2,1,3 ?? so what i did was create a new table called it ORDER created 2 col, one ID and the other Status put 1, 2, 3, in the ID and Available, In Contract and Accepted Offer, the did a JOIN with the Status col, and sorted by using the ID col in the ORDER table works like a chamr, but i would love to know if there is an easier way!!

Thanks
Replied 18 Sep 2003 15:00:17
18 Sep 2003 15:00:17 Julio Taylor replied:
hmm.

Well i'm not really sure if there's a better way to do it, but one thing i can tell you for sure is that if it works, don't fuck with it! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:

Reply to this topic