Jump to content

Archived

This topic is now archived and is closed to further replies.

mre2mpo

group by or order by problem

Recommended Posts

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

Share this post


Link to post
Share on other sites

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;

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.