Problem with LEFT JOIN - 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: Problem with LEFT JOIN (/showthread.php?tid=40819) |
Problem with LEFT JOIN - El Forum - 04-19-2011 [eluser]Miguel Diaz[/eluser] Hi I am new using codeigniter and I starting a blog from scratch, I have 4 tables First Table Articles articleID - articleTitle - articleUrl Second Table Comments commentID - Comment - commentUrl Third Table Categories categoryID - categoryName - categoryUrl Four Table categoriesSelection categorySelectionID - categoryUrl - articleID I am trying to us a leftjoin to union all the tables this one works perfect taking the category of each article Code: SELECT but when I try to make a count comments start duplicating values in the categoryUrl Code: SELECT Please can someone help on how can I make a count in the same query with the right values I am new with left joins and I need to make this for my job. please someone enlight me Thanks in advance Problem with LEFT JOIN - El Forum - 04-21-2011 [eluser]temon[/eluser] in Four Table categoriesSelection categorySelectionID - categoryUrl - articleID and in Second Table Comments commentID - Comment - commentUrl 1. I suggest you using categoryID for replace categoryUrl in categoriesSelection table, articleID for replace commentUrl in Comments table. 2. you just select from categoriesSelection table and joint other table. try it |