• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't figure this out...

#2
[eluser]GSV Sleeper Service[/eluser]
you'll have to join the two tables. something like this should work (no promises, this is off the top of my head, plus it's friday night, I'm stoned :/)
Code:
select a.*,count(c.id) as num_comments
from article a
left join article_comments c on a.id = c.articleid
group by a.id
order by num_comments
that group by is probably wrong, try it out and see how you get on.


Messages In This Thread
Can't figure this out... - by El Forum - 11-28-2008, 11:30 AM
Can't figure this out... - by El Forum - 11-28-2008, 01:05 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.