Hello everyone, I am having trouble implementing COUNT in a query and would like some advice
Given a query like
SELECT * FROM #__sometable ORDER by value DESC LIMIT 0, 20
I already get the records but how can I get those 20 records plus the total amount of records in that table, what I am trying to do is provide a table which displays the records, 20 at a time and provide a list of numbers say 1, 2, 3, 4 where 1 represents records 0-20, 2 represents 21-40 and so on but want to create those numbers dynamically, so if the table contains only 20 records I want to be able no to print those numbers but if the table contains 60 records then I want to place the numbers 1, 2, 3 with a link to make the query to the respective results, in that case if I click on 3 I will dynamically create a query like
SELECT * FROM #__somtable ORDER by value DESC LIMIT 41, 20
I know I can use COUNT but don’t know how to implement it in the same query so I don’t have to query the database twice