Home > database >  Dear bosses, xiaodi bucai, there is a SQL statements don't know how to write?
Dear bosses, xiaodi bucai, there is a SQL statements don't know how to write?

Time:09-15

There is a scene, do now is food merchant list query function, support regional switch
The following
1. The current position is jining, the client transfer the current latitude and longitude and the current number and city number, start screening of merchants, from jining region to other parts of the merchants, the list is sorted by distance from near to far (database merchants also have latitude and longitude, city code, area code, get the client pass the longitude and latitude and merchants in the database of longitude and latitude calculated distance, sorting from near to far)
2. Jining, here are qufu, jinxiang, and so on region
3. The switch switch area now, qufu
4. The client to pass on scripture latitude is changeless, qufu area code, city code is still jining
5. According to the area code first find merchants qufu all merchants in the table, according to the longitude and latitude to calculate distance, from near to far, followed by screening in other parts of the merchants, according to the longitude and latitude calculation, from near to far sorting, list followed by qufu merchants, in other parts of the merchants

CodePudding user response:

Latitude and longitude nearly, it must be the most appropriate, not to consider the traffic problem?

CodePudding user response:

reference 1st floor AHUA1001 response:
the latitude and longitude near, it must be the most appropriate, regardless of the traffic problem,

Is now want to sorted by distance from near to far, first row of the current regional merchants, to rest, if the switching area, there may be closer than the area of the region's businesses, but still to switch ranking first in the region, in other areas in turn back recently
  • Related