num_articles is just a temporary variable, it does not exist in the table structure and is just used to store the number of articles by each author.
Going by your table structure then try this.
Code:
mysql_query("SELECT COUNT(*) AS num_articles, `Author ID` FROM Articles WHERE `Cat Code`='it_tech' GROUP BY `Author ID` ORDER BY num_articles DESC LIMIT 10");
You did not specify the exact temr of your it tech field name so you need to put the correct field name in there.
You might need to copy/paste the query as there are backticks in there for fields with spaces. You really should not use spaces in field/table names, use hyphens or underscores instead.
The query will give you the top 10 Author ids and the number of articles. You can get at the data with
Code:
$result = mysql_query("SELECT COUNT(*) AS num_articles, `Author ID` FROM Articles WHERE `Cat Code`='it_tech' GROUP BY `Author ID` ORDER BY num_articles DESC LIMIT 10");
while ($row = mysql_fetch_row($result))
{
echo "Author ID = " . $row['Author ID'] . " Articles = " . $row['num_articles'] . "
";
}
Regards, Eamonn.