Hi Everyone,
Using the following code, I am working on a store locator script:
Code:
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;
(where 37 and -122 represent longitudinal and latitudinal values)
Given that it has a limit, how do I calculate the amount of entries found before the limitation? Because distance is being calculated, using count(*) will not work. Any suggestions?