SELECT DISTINCT nid sticky created vc value FROM node LEFT OUTER JOIN

1
SELECT DISTINCT n.nid, n.sticky, n.created, vc.value FROM {node} n LEFT OUTER JOIN {votingapi_cache} AS vc ON vc.content_id = n.nid LEFT OUTER JOIN {users_roles} AS ur ON ur.uid = n.uid LEFT OUTER JOIN {recomended} AS re ON re.content_id = n.nid WHERE n.promote = 1 AND n.status = 1 AND (n.type = 'story' OR n.type = 'page' OR n.type = 'poll') AND ( ( vc.value >= 3 AND vc.function = 'sum') OR ( ur.rid IN (3, 4)) OR n.uid = 1 OR re.content_id = n.nid ) GROUP BY n.nid ORDER BY n.sticky DESC, n.created DESC