Hello

I want write the SQL with MyModuleviews_query_alter

I have 2 content types :

Post Type Post

Name Title
Entity reference Post Type

I want show all Post Type which have one or more post

if($view->name == 'spaces_checking' ) {

foreach ($query->where as &$condition_group) {
foreach ($condition_group['conditions'] as &$condition) {

if ($condition['field'] == 'node.title') {
$condition = array(
'field' => 'node.nid',
'value' => 'SELECT SUBSTRING(source, 6) FROM {Post} ',
'operator' => 'in',
);
}
}

}
}

Comments

VM’s picture

per https://www.drupal.org/node/643758 please edit your post and move it to the 'module development & code questions' forum. Thank you.