Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By geohelper on
I'm trying to write the SQL statement to select all nodes of a specific type and order them by the sum vote and date created. This works but limits only to nodes that have been voted on...
SELECT node.nid, node.title, votingapi_cache.value
FROM node
INNER JOIN votingapi_cache ON votingapi_cache.content_id = node.nid
WHERE node.type = 'image'
AND node.status = 1
AND votingapi_cache.function = 'sum'
ORDER BY votingapi_cache.value DESC, node.created DESC
What do I have to do to get the nodes that have not been voted on too? Thanks in advance.
Comments
nevermind
AND (votingapi_cache.function = 'sum' OR votingapi_cache.content_id = NULL)