Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.