CI Builder Question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: CI Builder Question (/showthread.php?tid=90501) |
CI Builder Question - Tomasiomat - 03-27-2024 Hello together, I am at a loss. The following query over three tables gives me the following desired result. Code: SELECT What is the corresponding implementation in CI-query builder? PHP Code: $all_obj = $this->builder->select('objekte.obj_strasse, I always miss a field: 'Unknown column 'objekte.obj_id' in 'on clause' Any help is appreciated. Cheers, Thomas PS: it works with a raw query RE: CI Builder Question - Codinglander - 03-27-2024 (03-27-2024, 05:36 AM)Tomasiomat Wrote: Hello together, Hello Thomas. Where do you use the code ? In a controller? If yes, you should set the table first before running the builder. I see, you want to use the DOT-notation, but easier is set the "main" table and use the DOT-notation in the join-clause. Greetings... Kigh RE: CI Builder Question - Tomasiomat - 03-27-2024 Hi Kai, I missed this hint for the Builder class: "As shown earlier, the FROM portion of your query can be specified in the $db->table() method. Additional calls to from() will add more tables to the FROM portion of your query." Now it works :-) Cheers, Thomas RE: CI Builder Question - InsiteFX - 03-27-2024 Multiple method calls can be made if you need several joins in one query. If you need a specific type of [b]JOIN[/b] you can specify it via the third parameter of the method. Options are: left, right, outer, inner, left outer, and right outer. PHP Code: $builder->join('comments', 'comments.id = blogs.id', 'left'); |