Order By - in SQL
Jul 10th, 2009 by sherlock Hit :: 7090
ms_user table
user_id | username | area_id | |
1 | sherlock | c_sherlock@email.com | 1 |
2 | poirot | poirot@email.com | 2 |
3 | watson | b_watson@email.com | 1 |
4 | hasting | hasting@email.com | 2 |
5 | mycroft | a_mycroft@email.com | 1 |
SELECT * FROM `ms_user`
ORDER BY `area_id` , `email` DESC , `username`;
result ::
user_id | username | area_id | |
1 | sherlock | c_sherlock@email.com | 1 |
2 | watson | b_watson@email.com | 1 |
5 | mycroft | a_mycroft@email.com | 1 |
3 | poirot | poirot@email.com | 2 |
4 | hasting | hasting@email.com | 2 |
ow thx for this great tutorial :p