MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...) (/showthread.php?tid=72009) |
MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...) - kbs170 - 10-24-2018 Hi, is there a function in Codeigniter to use "JOIN .. USING .." like $this->db->join_using()? I use Codeigniter 3.0.4 with mariaDB and need the following statement: Code: JOIN (SELECT ... FROM ... WHERE) USING (...) instead of the "normal" JOIN .. ON ... , which results from Code: $this->db->join('mytable as my','t1.id = t2.id') I follow the post of newtover Feb 12 '13 at 15:54 ("What I would suggest") from https://stackoverflow.com/questions/14770671/maysql-order-by-before-group-by Code: SELECT * RE: MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...) - neuron - 10-25-2018 Why do you need USING clause, you can use ON clause intead: PHP Code: $this->db->select('max(post_date) as post_date, post_author') As I know there is no USING clause in CI Query builder. But if you want it you can extend Query_builder and implement your own join method RE: MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...) - kbs170 - 10-25-2018 Thank you very much! That works great! Best, kbs170 |