Hello :)

I'm working with a database of postcodes. I have an existsing query that returns the postcodes within a certain radius:

`select *, acos(cos(51.496502411798 * (PI()/180)) *cos(-0.13982862499836 * (PI()/180)) *cos(lat * (PI()/180)) *cos(lng * (PI()/180))+cos(51.496502411798 * (PI()/180)) *sin(-0.13982862499836 * (PI()/180)) *cos(lat * (PI()/180)) *sin(lng * (PI()/180))+sin(51.496502411798 * (PI()/180)) *sin(lat * (PI()/180))) * 3959 as Dist from SW having Dist < 1 order by Dist`

*Dist 1 is the number of miles for the search radius.*

I am making a script that will allow the user to enter a postcode and return a list of postcodes in the given radius. There can be over 20,000 results of which only 1000 will be displayed. Currently, I get all results into a PHP array and use the count() function to return the total, and just display upto 1000.

I would like to make the query produce **only a count of relevant matches**, and then make a follow up query with a limit of 1000 which will stop the unneccesary collection of data over 1000 rows.

Thanks for your time :D