Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    1

    Unanswered: Count Issue With Store Locator

    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?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    look up the FOUND_ROWS function in da manual
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •