Welcome Guest, Not a member yet? Register   Sign In
After upgrade from 1.7.2 to 2.1, LEFT OUTER JOIN mysql query throws a syntax error
#2

[eluser]Unknown[/eluser]
Yes, it's happening to me too. I'm trying to do this:

Code:
$this->db->join('table_a', ' ((table_b.key_id = table_a.key_id) AND (table_a.type = "my_type"))', 'left');

You are right that the preg_match is breaking it. The match says...

Code:
preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)

... that we will split my ON clause into exactly 3 parts -- [letters, numbers, underscores, or periods] followed by [spaces or non-letter-number-underscores] followed by anything. In my case, the three parts are

Code:
1. table_b.key_id
2. =
3. table_a.key_id) AND (table_a.type = "my_type"))

In other words, as written, the join command will ONLY work with simple ON clauses. Here's hoping they update the documentation to spell out the limitations of join.


Messages In This Thread
After upgrade from 1.7.2 to 2.1, LEFT OUTER JOIN mysql query throws a syntax error - by El Forum - 04-10-2012, 02:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB