Jump to content


Photo

group by or order by problem


  • Please log in to reply
2 replies to this topic

#1 mre2mpo

mre2mpo
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 07 October 2003 - 09:47 AM

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

#2 mre2mpo

mre2mpo
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 07 October 2003 - 09:57 AM

sorry the last bit should not be $countyname but $cityname

#3 mre2mpo

mre2mpo
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 07 October 2003 - 02:23 PM

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;




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users