Community & Support

Custom SQL statements for views

Hi-

A Drupal neu-b here - i love drupal a lot!

can anyone tell me if it is possible to edit the SQL statements created by views - i'm thinking especially of the WHERE clause

thanks!

jeff
los angeles

Comments

What are you trying to

What are you trying to achieve, ie what is the view not doing that you want it to?

views filter

i am trying to use ANDs and ORs

hook_views_query_alter

You can use hook_views_query_alter to alter the query that Views generates.

http://drupalcontrib.org/api/function/hook_views_query_alter

Ferlito/van der Wyk | Drupal web design & development

thanks

where can i find more info about how to use hooks? not sure how to form a SQL Select in the hook?

Here is the Views online

Here is the Views online help: http://views-help.doc.logrus.com/
Here is the doc on hooks: http://api.drupal.org/api/group/hooks

Ferlito/van der Wyk | Drupal web design & development

nobody click here