Skip to content

Instantly share code, notes, and snippets.

@apolzon
Created March 17, 2010 14:28
Show Gist options
  • Save apolzon/335283 to your computer and use it in GitHub Desktop.
Save apolzon/335283 to your computer and use it in GitHub Desktop.
SELECT node.nid AS nid,
node.title AS node_title,
node.created AS node_created
FROM node node
INNER JOIN users users ON node.uid = users.uid
LEFT JOIN node node_users ON users.uid = node_users.uid AND node_users.type = 'profile'
LEFT JOIN flag_counts flag_counts_node ON node.nid = flag_counts_node.content_id AND flag_counts_node.fid = 1
LEFT JOIN term_node term_node_value_0 ON node.vid = term_node_value_0.vid AND term_node_value_0.tid = 499
LEFT JOIN term_node term_node_value_1 ON node.vid = term_node_value_1.vid AND term_node_value_1.tid = 497
LEFT JOIN term_node term_node_value_2 ON node.vid = term_node_value_2.vid AND term_node_value_2.tid = 498
LEFT JOIN term_node term_node_value_3 ON node.vid = term_node_value_3.vid AND term_node_value_3.tid = 500
LEFT JOIN term_node term_node_value_4 ON node.vid = term_node_value_4.vid AND term_node_value_4.tid = 26
LEFT JOIN term_node term_node_value_5 ON node.vid = term_node_value_5.vid AND term_node_value_5.tid = 17
LEFT JOIN term_node term_node_value_6 ON node.vid = term_node_value_6.vid AND term_node_value_6.tid = 122
WHERE (node.type in ('resource')) AND (node.status <> 0 OR node.uid = 0 or 0 = 1) AND (term_node_value_0.tid = 499 OR term_node_value_1.tid = 497 OR term_node_value_2.tid = 498 OR term_node_value_3.tid = 500 OR term_node_value_4.tid = 26 OR term_node_value_5.tid = 17 OR term_node_value_6.tid = 122) AND (node.nid != 2632)
ORDER BY node_created DESC
LIMIT 0, 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment