Lengthy topic name. I'll try to keep it as simple as possible.
I'm making a pretty basic forum program and would like to display the forum names and the number of threads in that specific forum with one query.
Normally to get the number of threads I would do
SELECT COUNT(*) FROM ef_threads WHERE forum='ForumID'
But as I need to select the name of the forum from a sepperate table it obviously means the count doesn't work. I've tried COUNT(ef_threads.*) and other variations but it doesn't work. Any suggestions on the following query to get what I'm after would be most appreciated.
SELECT ef_forums.name AS ForumName, ef_forums.id AS ForumID, count(ef_threads.*) AS ThreadCount FROM ef_forums, ef_threads WHERE ef.threads.parentforum='ForumID'
Thanks in advance. And sorry for the complexity of my explanation. I never seem able to phrase my questions in an easy and concise way. Hopefully you can understand what I mean.




Bookmarks