I have a query that I need to get a total count of before I paginate. I was wondering if there was a way to return the total count within the same query before the limit is executed. I have to pass the total value to my back-end if thats possible.
What the query does-
-Finds rows that have are within a specified radius,
-that match a user entered keyword,
-orders by date then limit,
-offset for pagination.
SELECT *,
( 3959 * acos (cos ( radians(?) )* cos( radians( lat ) )*cos( radians( lng ) - radians(?) )+ sin ( radians(?) )* sin( radians( lat ) ))) AS distance
FROM job_posting
where job_title like ?
HAVING distance < ?
ORDER BY date_created DESC
limit ?, 25
I've looked at a couple different examples, but not sure how to implement it on this query. Any advice helps.