1

Is there any GET paramerter that can be pasted to get both the total_count (with limit) as well as the total count (without limit constraint)?

If I have

SELECT * FROM table WHERE val < 100

I might get a total_count of say 140 records but when I hadd

SELECT * FROM table WHERE val < 100 LIMIT 20

I will only get total_count 20 every time. I know I can send 2 queries but wondering if there is something that exists as a param that we are overlooking.

1

Total count returns the number of rows that the SQL API is retrieving as a result, not the total count of the amount of data in your table.

A SELECT * statement will retrieve everything in your table that fits your condition val<100 (which seems to be 140) while if you limit the query with LIMIT 20 the total count of the rows retrieved by the SQL API will be 20.

If you want to know the total amount of data in your table, independently of your current query, you could use:

SELECT *, (SELECT count(*) FROM table) as total_count_table FROM table WHERE val < 100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.