All,

I have a moderately expensive looking WHERE clause that I need to execute against a table. I would like to get both the total COUNT of all rows matching this clause, and a resultset bounded by a LIMIT clause.

At present I execute the query twice, once with COUNT and without the LIMIT clause, and once with the desired columns and with the LIMIT clause. This strikes me as inefficient and I would like to improve on it but don't know how to.

Is there any way of fetching both in one round trip?

Thanks,

— P