Created
October 19, 2018 17:52
-
-
Save DanLaufer/70020bcb03d8ea6e7c7dd22f2857063d to your computer and use it in GitHub Desktop.
Drupal 8 - SQL - Search for node in DB with specific field value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Join node table with a field table and search for published nodes of a certain type with a specific field value: | |
SELECT node.nid AS node_id, | |
LEFT(node.title, 10) AS node_title, field_data_field_reference_database_id.field_reference_database_id_value as ref_id | |
FROM node | |
LEFT JOIN field_data_field_reference_database_id | |
ON node.nid = field_data_field_reference_database_id.entity_id | |
WHERE type='location' | |
AND status='1' | |
AND field_data_field_reference_database_id.field_reference_database_id_value IS NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment