The problem is, to get count and table data, I have to hit the database two times in Django. For example:
count = queryset.count() # To get count
data = queryset.values('columns') # To get data
Is there any way to get data in the single query. One solution is to use len() function, but it is not good for a bigger table to load in RAM.
In mysql, I got this, But how to execute through Django ORM
SELECT t1.count, id FROM table1, (select count(*) as count FROM table1) as t1 limit 10;
Any help will be appreciated.