1
Guys, I have an Android app that uses Google Maps API. On the map, I get data from an SQL Server database. I need to create a KM radius where I only upload the database data that’s inside this radius. This based on the current geolocation of the user’s device.
I used Mysql, in it I could do it using this formula:
SELECT DISTINCT filiais.icon_logo_maps,
filiais.latitude_fil,
filiais.longitude_fil,
filiais.nr_cnpj_filial,
(6371 acos(cos(radians(latitude_dispositivo))cos(radians(filiais.latitude_fil))cos(radians(longitude_dispositivo) - radians(filiais.longitude_fil))sin(radians(latitude_dispositivo))sin(radians(filiais.latitude_fil)) AS distance
FROM _using.produto
INNER JOIN _using.filiais ON _using.produto.cnpj_filial = _using.filiais.nr_cnpj_filial
WHERE _using.produto.subcat = 'mercad'
HAVING distance <= 7;
How I could use this same formula for SQL Server?
In SQL SERVER I find the following error:
com.microsoft.sqlserver.jdbc.Sqlserverexception: Column name invalid Distance.