$this->default->join('db D', 'C.col1 = D.col1 AND D.col2 = "MAIN"', 'LEFT');
I am getting 500 error on this join in CI but when i only use
$this->default->join('db D', 'C.col1 = D.col1', 'LEFT');
query is ok.
How to do join in CI with and in the ON part of the join?
FYI
D.col2 = "MAIN"
in where clause also works What you have done should work but there are two things you could try to see if the outcome is better.
Test1: Which just exchanges where double and single quotes are used.
$this->default->join('db D', "C.col1 = D.col1 AND D.col2 = 'MAIN'", 'LEFT');
Test 2: Which turns off escaping the values and identifiers for the join
call
this->default->join('db D', 'C.col1 = D.col1 AND D.col2 = "MAIN"', 'LEFT', FALSE);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.