desithugg Posted August 13, 2006 Share Posted August 13, 2006 [code]$query = "SELECT forums.pic,forums.name,forums.des,forums.poster,forums.timer,forums.id,threads.fid FROM forums left join threads on threads.fid = forums.id where category = 'general' ORDER BY ors ASC";$result = mysql_query($query) or die(mysql_error());[/code]on the threads table i want to count how many threads are there that have the threads.fid = forums.iddo i use count i have tried count(threads.fid) and threads,count(fid) but didnt work. any other ideas? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 13, 2006 Share Posted August 13, 2006 try[code]$query = "SELECT forums.pic,forums.name,forums.des,forums.poster, forums.timer,forums.id, COUNT(threads.fid) as threadcount FROM forums left join threads on threads.fid = forums.id where category = 'general' ORDER BY ors ASC";[/code] Quote Link to comment Share on other sites More sharing options...
desithugg Posted August 13, 2006 Author Share Posted August 13, 2006 i ahve tried that barand but i get this errorMixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause Quote Link to comment Share on other sites More sharing options...
Barand Posted August 13, 2006 Share Posted August 13, 2006 Oops[code]$query = "SELECT forums.pic,forums.name,forums.des,forums.poster, forums.timer,forums.id, COUNT(threads.fid) as threadcount FROM forums left join threads on threads.fid = forums.id where category = 'general' GROUP BY forums.id ORDER BY ors ASC";[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.