I have written the following query:
select
*,
count(pk_id) as row_count
from employee
group by
pk_id
But I am not getting 1 as the row_count value for every column.
How can I get the total number of rows returned as the result of the query?
Can someone please help?
And one more thing is I don’t want to write any subquery 🙁
Have you considered either just counting the rows as you receive them in whatever’s consuming this result set, or just using FOUND_ROWS? Is there some reason you need the rowcount to appear as a column in the result set?