mre2mpo Posted October 7, 2003 Share Posted October 7, 2003 I have a query where I want to search for users from a county but there is also a nearestcity field. What I want to do is select a nearestcity and display these first and then display the rest of the users from that county. I am not quite sure how do it. $query = \"select * from users where county = $countyname ?????then wat do I need to do with $countyname. Michael Quote Link to comment https://forums.phpfreaks.com/topic/1122-group-by-or-order-by-problem/ Share on other sites More sharing options...
mre2mpo Posted October 7, 2003 Author Share Posted October 7, 2003 sorry the last bit should not be $countyname but $cityname Quote Link to comment https://forums.phpfreaks.com/topic/1122-group-by-or-order-by-problem/#findComment-3813 Share on other sites More sharing options...
mre2mpo Posted October 7, 2003 Author Share Posted October 7, 2003 I have fixed the problem if anyone else has the same problem then the code is $query = \"select * from user where county = $countyid order by nearestcity = $nearestcityid DESC; Quote Link to comment https://forums.phpfreaks.com/topic/1122-group-by-or-order-by-problem/#findComment-3815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.