Jump to content
Larry Ullman's Book Forums

Chris123

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Chris123

  1. Hi again. I just have a question on the second last pursue exercises for chapter 3 (page 118) about the maximum range for distance. I've created the form to optionally search by range with no problem but my SQL is coming up with errors.

     

    I added the WHERE distance<=X to the query as noted in page 107, however adding this comes up with SQL syntax errors. I think this SQL could be causing errors due to it using a WHERE on an alias, but I could be wrong. Any help on this would, as always, be greatly appreciated.

     

    Example SQL:

    SELECT name, CONCAT_WS('', address1, address2), city, state, stores.zip_code, phone, ROUND(return_distance(39.09, -94.58, latitude, longitude)) AS distance FROM stores WHERE distance<=1000 LEFT JOIN zips USING (zip_code) ORDER BY distance ASC LIMIT 3

    Did you ever get this figured out?? i am pulling my hair out trying to figure out where to put this WHERE distance<=x in the sql............I keep getting syntax errors.

×
×
  • Create New...