MySQL Forums
Forum List  »  PHP

MySql Query Help
Posted by: Alan Lynch
Date: March 30, 2013 12:50AM

Hi professionals.

i am new to php and mysql and I am trying to query my database to calculate the distance with the help from google instructions on this page.

https ://

when I try to query my database with the following query as advised by them no results are returned. here is my query, I think it is because of the order of exectuion of sql statement and it does not recognise the "distance" column name

SELECT suburb, state, latitude, longtitude, ( 6371 * acos( cos( radians(153) ) * cos( radians( latitude ) ) * cos( radians( longtitude ) - radians(-27) ) + sin( radians(153) ) * sin( radians( latitude ) ) ) ) AS distance FROM Postcode HAVING distance < 25 ORDER BY distance

any ideas as I really need the distance < 25 part so users can search by distance


Options: ReplyQuote

Written By
MySql Query Help
March 30, 2013 12:50AM
March 30, 2013 12:53AM
March 30, 2013 06:20AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.