The following is the content of the $query
object that is passed to a view.
[where] => Array( [0] => Array( [clauses] => Array( [0] => node.type in ('%s') [1] => node.status 0 [2] => node.promote 0 [3] => node.sticky 0 ) [args] => Array( [0] => test ) [type] => AND ) ) [having] => Array() [group_operator] => AND
I want to override it by using hook_views_query_alter()
. The default operators are all AND, but I want to get the following query
[0] => node.type in ('%s') AND [1] => node.status 0 AND [2] => node.promote 0 OR [3] => node.sticky 0
How do I make the last operator to use "OR"?
db_query("SELECT content_id, count(*) AS cnt FROM {votingapi_vote} WHERE value =1 AND value_type = '%s'" , "option");
How do I use the query in hook_views_query_alter()?