if you are returning the record set to a scripting language like php, you could simply loop over the results for your counts
or, since you want to show the count as part of a link, then you are on a different page that does not use the detailed result set, so you would use a simpler count query
finally, look up the FOUND_ROWS function, you will need it too