Reputation: 3688
In my schema there are several tables, let's say, t1, t2, t3.
I want to create a simple statistics page for the admin of the page, like displaying the number of rows of each of the tables at a generic view file.
I know that with SQL this is really simple like:
select count(*) from t1;
But how can I go about doing this from a view file?
Also, do you think this is an efficient way to do that (regarding that it's for the admin page which will not be used that much)?
Upvotes: 0
Views: 26
Reputation: 9523
Supposing every table corresponds to a model class. You can view the results of:
TableOneModel.count
TableTwoModel.count
TableThreeModel.count
Upvotes: 3