I have this query in SQL
select *
from node n, node_collection_data nc
where n.nid = nc.nc_child_nid
and
nc.nc_parent_nid = (select nc_parent_nid
from node_collection_data
where nc_child_nid=17)
This is what I got so far:
$query -> join('node_collection_data', 'nc', 'n.nid =
nc.nc_child_nid'); $query->condition('type', $node->type)
->condition('status', 1)
->condition('n.nid', $node->nid, '!=')
->condition(db_or()
->condition('n.language', array($language->language, LANGUAGE_NONE), 'IN')
->condition('n.language', $node->language, '=')
)
// get nc_child_id
//->join('node_collection_' . $sort, $sort, 'n.nid = ' . $sort . '.nc_child_id')
->fields('n', array('nid', 'title'))
->fields('nc',array('nc_parent_nid')) // select nc_parent_id
I am trying to convert the last part.
nc.nc_parent_nid = (select nc_parent_nid from node_collection_data where nc_child_nid = 17)
How can I convert it to db_select()
?