Skip to content

Instantly share code, notes, and snippets.

@joelpittet
Created December 6, 2012 17:58
Show Gist options
  • Save joelpittet/4226558 to your computer and use it in GitHub Desktop.
Save joelpittet/4226558 to your computer and use it in GitHub Desktop.
SELECT u.uid, u.name, u.mail as email, u.status,
EXISTS (
SELECT n.nid nid, NULL as uid FROM node n
WHERE n.type = 'manual' AND n.status = 1 AND nid NOT IN (
SELECT fc.content_id nid FROM flag_content as fc
RIGHT JOIN node n ON (fc.content_type = 'node' AND fc.fid = 3
AND fc.content_id = n.nid AND n.type = 'manual' AND n.status = 1)
WHERE fc.uid = u.uid
)
) as read_manuals
FROM users as u
LEFT JOIN users_roles ur ON u.uid = ur.uid AND ur.rid IN (4, 5, 30)
WHERE u.uid <> 0 AND ur.rid IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment