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

所有这些代码所做的是获取距离,然后按升序将它们显示在 microsoft sql 表中,并且它还有一个条件是只显示 150 英里内的距离,但我不知道如何在 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 回答