prakash Posted October 7, 2007 Share Posted October 7, 2007 Hi, I have 2 filed on my database. The data on that table as follows FIELD1 FIELD2 ================ NA 1 NA 9 NC 3 NA 4 NA 2 so if I query like select * from table order by field1 then it will list out data like NA1 NA9 NA4 NA2 NC3 but I want to order both field1 and field2 and want to display data as NA1 NA2 NA4 NA9 NC3 so what will be my mysql query? thanks Link to comment https://forums.phpfreaks.com/topic/72187-solved-helo-sorting-mysql-data/ Share on other sites More sharing options...
Norsk.Firefox Posted October 7, 2007 Share Posted October 7, 2007 SELECT * FROM table ORDER BY field1 ASC AND field2 ASC (Doesn't quite remember if it is "AND" or a comma "," between the two statements. Link to comment https://forums.phpfreaks.com/topic/72187-solved-helo-sorting-mysql-data/#findComment-364022 Share on other sites More sharing options...
prakash Posted October 7, 2007 Author Share Posted October 7, 2007 SELECT * FROM table ORDER BY field1 ASC AND field2 ASC (Doesn't quite remember if it is "AND" or a comma "," between the two statements. wow thanks man being an php programmer I never knew that mysql also supports same on "order by" it got work on SELECT * FROM table ORDER BY field1 ASC, field2 ASC again thanks for your help Link to comment https://forums.phpfreaks.com/topic/72187-solved-helo-sorting-mysql-data/#findComment-364027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.