Jump to content

[SOLVED] Intro Outro ORDER


jaymc

Recommended Posts

Lets say I have a table, in that table there is a field where a number can be between 0-100,000

 

I want to pull out all records closest to a number I specify

 

For instance if the number I specify is 800, it should return

 

799, 801, 798, 802, 797, 803

 

NOT 801, 802, 803 or vice versa which is what I would get using a standard order.

 

I cant use BETWEEN or < > because the closest number to a number I specify maybe 350 digits away, its dynamic

 

Just think of it as a program which calculates the 10 closest people to someone standing directly in the middle of a circle. Each time you load the script the position of the people are different, hence cant use BETWEEN etc

 

Im actually using this to calculate the people closest to a postcode based on long and lat, but the circle example will surfice!

 

Any ideas on the best way to do this in pure MYSQL

Link to comment
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.