This is the query of PHP using MySQL. can anyone please convert this query to sqlite query?
Query:
select SQRT(POW(latitude, 2) + POW(longitude, 2)) *110 as dist from route
Best Regards, Thanks
I have done it with the help of "pascal".
The query becomes:
SELECT
*
FROM
(
SELECT
temperature,
climate,
temperatureTime,
photoURL,
(((latitude - 37.331689) * (latitude - 37.331689)) + (longitude - (-122.030731)) * (longitude - (-122.030731))) * (110 * 110) AS dist
FROM
weather
)
AS tab
WHERE
tab.dist <= (1.0 * 1.0);
This query is used to find out the nearest coordinates of locations around me within 1 KM.
It's trivial to register PHP's sqrt with sqlite_create_function.
sqlite_create_function($sqlite_db, "sqrt", "sqrt", 1);
Without registering, you can use:
php('sqrt', value);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With