tags:

views:

25

answers:

1

How can I combine these two query's together if possible? I want to be able to find all the articles first and then find there comments

Here is query 1

SELECT * 
FROM users_articles 
INNER JOIN users ON users_articles.user_id = users.user_id
AND users.active IS NULL
AND users.deletion = 0

Here is query 2

SELECT * 
FROM articles_comments
INNER JOIN users ON articles_comments.user_id = users.user_id
A: 

you can add another join to the first query and get all.

like :

SELECT * 
FROM users_articles 
INNER JOIN users ON users_articles.user_id = users.user_id 
AND users.active IS NULL
AND users.deletion = 0
INNER JOIN articles_comments ON articles_comments.user_id = users.user_id

but you get duplicate data of articles , you get the same article data row for every comment of the same article.

Haim Evgi
I get the error Not unique table/alias: 'users'
blah
i fix my mistake
Haim Evgi
THIS is not what I am looking for can u help with a Cross-aggregates version?
blah