1
vote
1answer
1k views

How do I add an SQL query with hook_views_query_alter()?

I have the following SQL query: db_query("SELECT content_id, COUNT(*) as count FROM {votingapi_vote} WHERE value_type = '%s' AND value = 1 GROUP BY content_id;", "option"); If ...
16
votes
4answers
4k views

Custom query in Views?

At some point I found the need to modify an SQL query generated by Views, in the end I overrode views_pre_execute and changed the query for that specific view. This feels like an ugly hack to me and ...
4
votes
2answers
509 views

How do I optimize a Views “execute_count_query”?

So, I was able to optimize a particularly nasty query in one of my views using mymodule_views_query_alter(), bringing it from 13 seconds down to about 200 milliseconds. However, I see in my Devel ...
2
votes
2answers
337 views

Changing an inner join to a left join in views 3.3?

Using views 3.3, I have a view in Drupal 7 where I am showing two content types. I have a filter criteria based on the value of a field that is attached only to one of the content types. So long as I ...
1
vote
1answer
399 views

Views - sticky items per page paginated using several displays (Hooks or UI way)

Hi and thanks for take the time to read this post. (I want to know if exist some hook or User Interface way to make this) I have two content types (content type X and content type Y), and I want to ...