[SOLVED] A Little Help Please? - 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: [SOLVED] A Little Help Please? (/showthread.php?tid=31605) |
[SOLVED] A Little Help Please? - El Forum - 06-25-2010 [eluser]defectivereject[/eluser] Hi all, I'm trying to code a skills matrix as a project to make life easier at work. I've done the large bulk of it, but have hit one problem. Now i have 8 tables, and in one query i'm using 4 of them to check for qualifications that an individual should have in their role. Now i have a 'Required_roles' table containing a role_id, a qu_id 'qualification' table containing q_id, qualification (q_id matches qu_id) 'records' table containing staff_id and the qual_id (qual_id matches q_id and qu_id) 'staff' table containing r_id, s_id (r_id matches role_id and the s_id matches staff_id) there are other fields in these tables but i don't need those fields. Now i run a query from my controller that gets the qualifications held by an individual and that runs no problems. i then run a second query to get those that the individual should have, but doesn't. which runs and returns the ones they don't currently hold BUT if someone of a different role holds that qualification it omits that one, but i don't want it to!!! Here is my query, so if anyone can help i would be grateful as for what $horseyman is.... thats just passing on the uri/segment which is the persons s_id Code: function test2($horseyman) { Many Thanks in advance [SOLVED] A Little Help Please? - El Forum - 06-25-2010 [eluser]Jan_1[/eluser] did you try out 'where' earlier then 'join'? and do i understand this: qu_id = qual_id = NULL ? [SOLVED] A Little Help Please? - El Forum - 06-25-2010 [eluser]defectivereject[/eluser] Yeah i changed the query around to as follows Code: function test2($horseyman) { gives the same results Code: [17] => Array the Qual_id is Null as i'm looking for those. BUT as with this one r_id is 9 and he needs qu_id of 37. BUT s_id of 1 with a role_id of 4 has a qu_id in the records table of 37 so its omityting that, although i'm asking it not to as i'm looking for a qu_id of 37 where r_id is 9 EDIT: Could it be that i'm not actually specifying where the r_id is 9? Maybe that is it? [SOLVED] A Little Help Please? - El Forum - 06-25-2010 [eluser]defectivereject[/eluser] i solved it, just needed some additional where statements Code: $this->db->select('s_id, r_id, qu_id, staff_id, qual_id, qualification, required_by' ); thanks for the help anyways! |