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:
instead of the "normal" JOIN .. ON ... , which results from
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
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';