How does one count the number of articles owned by each author? In addition, the maximum number of articles displayed is the first one) the total number of words in the article content is displayed in the list. The second one is the number of articles. The second one is displayed in the list, and so on, you are going to make an article to count the number of words
Article table
Id author titile content
How to count the number of articles owned by each author and sort the number of articles from many to few
Is the first to display the maximum number of articles (the maximum number of displayed articles) in the total number of words
Next, use the list to display the titles.
The second is to display the second-largest number of articles.
And so on
I don't have a good idea. I think it's too troublesome. I want to learn a good idea.
------ Solution --------------------
What are you going to do? I can tell you how to count the number of words in an article in a simple way.
------ Solution --------------------
SQL code
SELECT id, titile, SUM (LENGTH (titile) AS lengthFROM 'Your _ table' where author = '". $ author." 'Order by length desc
------ Solution --------------------
SQL code
Select count (*) as count, author, sum (length (content), group_concat (title) group by authororder by count DESC
------ Solution --------------------
An SQL statement cannot be used. Use foreach. The author is outside, and the article title list is inside.