Scroll
How to change the SQL query in views?
Forums
Hello, I need to modify a views query.
I'm using hook_views_query_alter
function custom_module_views_query_alter(&$view, &$query) { if ( $view->name == 'uc_catalog_terms' ) { $query->where[0]['conditions'][0]['field']="SUBSTRING('taxonomy_term_data.name, 1, 1)"; } }
However, the query removes all characters, resulting in views making the following query:
WHERE (( (SUBSTRINGtaxonomy_term_data.name11 = 'a') ))
Why are the characters being removed, and how can I address this?
I found on a foreign forum that the error was in version 7x.3.dev,
I am using version 7.x-3.7