The following query returns null in MySQL. I check all things like cos, acos individually. But this query is returning NULL. Kindly help me.
altitude and latitude is the geo location of the places
select
acos(sin(74.338372290294) * sin(altitude) +
cos(74.338372290294) * cos(altitude) *
cos(latitude) - (31.552278760192)) as omg
from shk_resturants
If any of the values in your table (latitude or altitude) are NULL, the result may be NULL also. Try to use the function
e.g.
This returns 0 for the columns, that have NULL-values.
See: MySQL Comparsion-Operators and: MySQL Math-Functions