johnsmith153 Posted July 28, 2010 Share Posted July 28, 2010 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 More sharing options...
Pikachu2000 Posted July 28, 2010 Share Posted July 28, 2010 Then you need to list them all explicitly, which you should always do anyhow. Link to comment https://forums.phpfreaks.com/topic/209059-complex-sql-statement/#findComment-1091930 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.