just look at http://drupal.org/node/13689 and you will understand.
One of the biggest example is in node_page_default of the node module.
my suggestion :
function node_page_default() {
if (function_exists("term_access_get_terms_string")) {
$term_access = 1;
$query = 'SELECT DISTINCT n.nid, n.type FROM {node} n LEFT JOIN {term_node} t ON n.nid = t.nid WHERE (t.tid IN ('. term_access_get_terms_string() .') OR t.tid IS NULL) AND n.promote = 1 AND n.status = 1 ORDER BY n.static DESC, n.created DESC';
$count_query = 'SELECT count(DISTINCT (n.nid)) FROM {node} n LEFT JOIN {term_node} t ON n.nid = t.nid WHERE (t.tid IN ('. term_access_get_terms_string() .') OR t.tid IS NULL) AND n.promote = 1 AND n.status = 1';
$result = pager_query($query, variable_get('default_nodes_main', 10), 0, $count_query);
}
else {
$result = pager_query('SELECT nid, type FROM {node} WHERE promote = 1 AND status = 1 ORDER BY static DESC, created DESC', variable_get('default_nodes_main', 10));
}
...
Comments
Comment #1
(not verified) commented