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
Use ROUND( number , digits )
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`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.