Select Max records multiple rows - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Select Max records multiple rows (/showthread.php?tid=43920) |
Select Max records multiple rows - El Forum - 07-27-2011 [eluser]dazed[/eluser] Hi Guys, I know the title may not be the best description. I have a DB with a revision system. I need to collect all articles with the highest revision number. Code: +------------+------------+----------------+ so the result should look Code: +------------+------------+----------------+ closest i got was Code: $query = $this->db->query('select articleid, revisionid, max(revisionnumber) from articles where userid = 83 group by revisionid'); I have googled loads but cannot get more than one result back. Cheers Dazed Select Max records multiple rows - El Forum - 07-27-2011 [eluser]jmadsen[/eluser] Code: SELECT articleid, revisionid, revisionnumber |