Welcome to WebmasterWorld Guest from 54.167.85.221

Forum Moderators: open

Message Too Old, No Replies

Need help in sorting mysql result

mysql result sort

     

aldwin

2:05 am on Jun 1, 2013 (gmt 0)



i have this table:

+--------+------------+
| ID | name | type
+--------+------------+
| 1 | Alex | 0
| 2 | John | 1
| 3 | Gerry | 0
| 4 | Mark | 0
| 5 | Dave | 1
| 6 | Blake | 0
+--------+------------+

how can i get an output that is ordered alphabetically, but also displaying those with TYPE==1 first?

needed output:
Dave
John
Alex
Blake
Gerry
Mark

LifeinAsia

2:10 am on Jun 1, 2013 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



If Type is only 0 or 1, you can use:
ORDER BY Type DESC, Name

aldwin

2:23 am on Jun 1, 2013 (gmt 0)



that worked, thanks :)

phranque

11:04 am on Jun 1, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, aldwin!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month