0
 SELECT       name, address1, address2, address3, city, state, zip, faxnum, phonenum, emailaddress, 
  odbcadmin.fn_calDist(- 0.03715491813985, 0.9178158214586024, long * 0.0174532925, lat * 0.0174532925) 
  AS distances
  FROM       dbo.Customer 
  WHERE     (odbcadmin.fn_calDist(- 0.03715491813985, 0.9178158214586024, long * 0.0174532925, lat * 0.0174532925) <= 150)
  ORDER BY distances

all this code is doing is fetching the distances and then showing them in a microsoft sql table in ascending order and also it has a condition that says only the distances within 150 miles are shown but i have no clue how to round in sql

4

1 に答える 1

1

ROUND(数字,数字)を使用

SELECT       name, address1, address2, address3, city, state, zip, faxnum, phonenum, emailaddress, 
  ROUND(odbcadmin.fn_calDist(- 0.03715491813985, 0.9178158214586024, long * 0.0174532925, lat * 0.0174532925) ,2)
  AS distances
  FROM       dbo.Customer 
  WHERE     (ROUND(odbcadmin.fn_calDist(- 0.03715491813985, 0.9178158214586024, long * 0.0174532925, lat * 0.0174532925),2) <= 150)
  ORDER BY distances`
于 2013-10-02T08:09:31.777 に答える