Forum Moderators: coopster

Message Too Old, No Replies

ORDER BY is not listening!

Problems when sorting by multiples.

         

inveni0

4:40 pm on Jan 6, 2007 (gmt 0)

10+ Year Member



Okay, here's the ORDER BY code:

ORDER BY Avail , Loc DESC

'Avail' is a column that contains only a 0 or a 1. I want the 1's at top.

'Loc' is a column that contains only a, b, c, or d. I want those in order a-d.

The script is successfully sorting a-d within all rows where column avail is 0, and again in all rows where avail is 1. Everything looks EXACTLY as I want it to...but....

The rows in which avail is 1 should be on top. No matter what I do, they always get slammed to the bottom.

Any tips?

EDIT: I have also tried:

ORDER BY Avail , Loc ASC

inveni0

4:47 pm on Jan 6, 2007 (gmt 0)

10+ Year Member



Ahhhh...

I got it already. I used:

ORDER BY Avail DESC , Loc ASC , Addy ASC

Having the ASC,DESC for each fixed it...I didn't know you could do that!

eelixduppy

4:48 pm on Jan 6, 2007 (gmt 0)



Nice, glad you got it! ;)

henry0

4:54 pm on Jan 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Deleted post
too late!