How can I get total row count without blowing up types?
I have a simple query function that is in charge of generating a list of ids so that it can be passed into a function which does some other fancy stuff with those ids as a CTE. Like so:
Now, the problem is I also want to get the total row count with
COUNT(*) OVER()
so that I don't have to make two trips. But if I try to add sql
to the select list to get that value, the type system loses its mind... Can I somehow cast the sqlCOUNT(*) OVER()
to behave as if the query is going to return a column with the name total and make it not worry about how?1 Reply
Solution
I guess maybe this works?