Welcome Guest, Not a member yet? Register   Sign In
MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...)
#1

(This post was last modified: 10-25-2018, 01:09 AM by kbs170.)

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/1477...e-group-by



Code:
SELECT *
FROM wp_posts
INNER JOIN
(
 SELECT max(post_date) post_date, post_author
 FROM wp_posts
 WHERE post_status='publish' AND post_type='post'
 GROUP BY post_author
 ORDER BY post_date DESC
 -- LIMIT GOES HERE
) p2 USING (post_author, post_date)
WHERE post_status='publish' AND post_type='post';
Reply


Messages In This Thread
MariaDB / mysql: JOIN (SELECT ... FROM ... WHERE) USING (...) - by kbs170 - 10-24-2018, 03:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB