In my Drupal Query I need to recreate something like this using a dynamic query:
WHERE (node_field_data.status = 1)
AND (node__field_document_places.entity_id IN (SELECT entity_id FROM node__field_document_places where field_document_places_target_id = 51673))
In my code here is the relevant part of my dynamic query I am building:
$connection = Database::getConnection();
$query = $connection->select('node_field_data', 'node_field_data');
$query->condition('node_field_data.status',1);
$query->condition('node__field_document_places.entity_id',[ -- Can I do this here somehow? -- ], "IN");
I could technically run a seperate Query before hand and output the ids in array here. But I was hoping to keep a single DB call to help with speed.
My Question is, is there a way to do this using dynamic queries, and is there even a performance benefit to do it this way.