I need to get the number of query rows, and also get the query columns in one query. The score should be part of the result columns (it should be the same for all rows, since it is shared).
for example, if I do this:
select count(1) from table
I can have a total number of rows.
If I do this:
select a,b,c from table
I will get the column values for the query.
I need to get the number and values of columns in one query in a very efficient way.
For example:
select Count(1), a,b,c from table
without a group, since I want a total.
The only way I found is to create a temporary table (using variables), insert the query result, then count, and then return the union of both. But if the result gets thousands of records, it will not be very effective.
Any ideas?
source
share