Welcome Guest, Not a member yet? Register   Sign In
Joining tables together in a model function
#3

[eluser]Jaketoolson[/eluser]
I'm still not a 'convert' to structuring my queries using CI. I still use their DB Class to plow through the results, it's just that the actually query itself I still write out 'by hand' as this just makes more sense to me. Plus I interact with these databases in MS Access and therefore have to rewrite said queries to SQL/Access format.

Perhaps you need to start over from scratch and just write the entire query out and see if you get the desired results that way? My guess is that it's your table join, being a RIGHT join. Why not an INNER?

Code:
$sql = "SELECT * FROM table a
INNER JOIN table b ON b.id=a.id
INNER JOIN table c ON c.u_id=a.u_id
WHERE a.x = b.y
ORDER BY a.xx ASC";
$query = $this->db->query($sql);


Messages In This Thread
Joining tables together in a model function - by El Forum - 02-08-2011, 04:57 PM
Joining tables together in a model function - by El Forum - 02-08-2011, 09:26 PM
Joining tables together in a model function - by El Forum - 02-08-2011, 11:15 PM
Joining tables together in a model function - by El Forum - 02-09-2011, 06:25 AM
Joining tables together in a model function - by El Forum - 02-09-2011, 10:58 AM
Joining tables together in a model function - by El Forum - 02-09-2011, 11:57 AM
Joining tables together in a model function - by El Forum - 02-09-2011, 08:43 PM
Joining tables together in a model function - by El Forum - 02-09-2011, 08:53 PM
Joining tables together in a model function - by El Forum - 02-10-2011, 03:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB