Jump to content

Complex SQL statement


johnsmith153

Recommended Posts

Ok it's not that complex but has got me.

 

SELECT ((ACOS(SIN(".$lat." * PI() / 180) * SIN(`lat` * PI() / 180) + COS(".$lat." * PI() / 180) * COS(`lat` * PI() / 180) * COS((".$long." - `long`) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS `distance` FROM `users`    etc....

 

The above is for working out lat/long values.

 

However I need to adust the above to return ALL fields from the table. I know * will do it but how would I incorporate the extra stuff that I have? There are 20/30 fields and I have just taken over the code so can't be 100% exactly which fields need pulling so must pull all.

Link to comment
https://forums.phpfreaks.com/topic/209059-complex-sql-statement/
Share on other sites

Archived

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

×
×
  • Create New...

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.