Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Forked from anonymous/gist:7379243
Last active December 27, 2015 19:48
Show Gist options
  • Save Greg-Boggs/7379255 to your computer and use it in GitHub Desktop.
Save Greg-Boggs/7379255 to your computer and use it in GitHub Desktop.
Select all Journal Entries written by user 1
SELECT *
FROM node node
LEFT JOIN users users_node
ON node.uid = users_node.uid
LEFT JOIN field_data_body field_data_body
ON node.nid = field_data_body.entity_id
AND (field_data_body.entity_type = 'node'
AND field_data_body.deleted = '0')
LEFT JOIN field_data_field_image field_data_field_image
ON node.nid = field_data_field_image.entity_id
AND (field_data_field_image.entity_type = 'node'
AND field_data_field_image.deleted = '0')
LEFT JOIN field_data_field_course_reference field_data_field_course_reference
ON node.nid = field_data_field_course_reference.entity_id
AND (field_data_field_course_reference.entity_type = 'node'
AND field_data_field_course_reference.deleted = '0')
WHERE (node.type
IN 'journal_entry'
AND users_node.uid = '1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment