I have the following raw SQL:
SELECT *
FROM node_field_data n
LEFT JOIN book b ON n.nid=b.nid
WHERE n.type IN ('book')
AND (b.has_children != 1 OR b.nid IS NULL)
I have a module that I need to add this query to, so I already have a $query object. The problem I'm having is finding the documentation/syntax to do the LEFT JOIN part of my query.
This is what I've added to $query
.
$query->addWhere(0,'node.nid', 'b.nid');
$query->addWhere(0,$types,'IN');
$query->addWhere(0,'b.has_children',1,'<>');
$query->addWhere(1,'b.nid','IS NULL');
How do I add the LEFT JOIN
part?