[eluser]kgill[/eluser]
[quote author="ddbt" date="1252520535"]Wow jegbagus,
you make it look very easy. One last request.. could this be translated into CodeIgniter terminology.. using terms like $this->db->select, $this->db->where.. etc. And so that it can be run like one query from a controller?
Really, thank you all![/quote]
There's a problem with jegbagus' code - if a post has no comments it won't be selected. Do yourself a huge favour and find a tutorial on SQL joins - if the terms outer join are daunting then you need to read up on them not ask for simpler solutions. Without that knowledge you're both unaware a problem existed and that the code sl3dg3hamm3r posted fixed it using a left outer join - if he hadn't you'd be implementing a solution that only partially works.
@sl3dg3hamm3r you're nicer than I am - I'm a crusty old curmudgeon who would have left it to him to figure out for himself, I mean and don't spoon-feed answers.