I have the following statement used in open atrium (based on drupal)
SELECT *
FROM users u
LEFT JOIN user_status us on((u.uid = us.user_id))
LEFT JOIN status s on((s.status_id = us.user_status))
LEFT JOIN node n on((n.uid = u.uid))
LEFT JOIN content_type_profile p on ((n.nid = p.nid))
WHERE n.type = 'profile';
I want it to show ALL entries in the user table, and append data from the other joins onto that. If there isn't a match, I am ok having a NULL value'd column.
However, it only matches users that have a node.type = 'profile'. If i don't include this however, I get all the entries from the node table, and I don't want that.
Question
-Dave-
I have the following statement used in open atrium (based on drupal)
SELECT *
FROM users u
LEFT JOIN user_status us on((u.uid = us.user_id))
LEFT JOIN status s on((s.status_id = us.user_status))
LEFT JOIN node n on((n.uid = u.uid))
LEFT JOIN content_type_profile p on ((n.nid = p.nid))
WHERE n.type = 'profile';
I want it to show ALL entries in the user table, and append data from the other joins onto that. If there isn't a match, I am ok having a NULL value'd column.
However, it only matches users that have a node.type = 'profile'. If i don't include this however, I get all the entries from the node table, and I don't want that.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts