Hi. I have been looking to create a list in views that takes a single CCK field and returns a list of distinct values for that field. Kind of like a glossary
Let me give an example
I have a few thousand vinyl records in a store, and the customer may choose to browse by record artist.
I would like my view to show a list of artists, A to Z. eg
AC/DC
Ace Of Base
Aerosmith
etc..
however, if I have two (or more) vinyls by Ace Of Base in my store, the search will currently return
AC/DC
Ace Of Base
Ace Of Base
Aerosmith
etc...
I realised that this was because I needed to add something along the lines of GROUP BY artist_field into my query. So I duly set up a module implementing hook_views_query_alter and added it in. However, I have found that instead of the query just having one field in the GROUP BY section of the query, it adds all the fields!!
I have done some hefty searching trying to solve this and found that the hook_views_query_alter used to work before Views 2.3 but from there on, it has not worked. I assume this is a bug? Please let me know if this is intentional.
The post I found out about it working previously is below.
http://groups.drupal.org/node/18277
I am currently jyst using views 2.2 until I know it will work and then I can happily continue with the current version!
Thanks
BTW, excellent work on Views, it has to be one of, the best modules for drupal.
Comments
Comment #1
merlinofchaos commentedThis is not a bug. Due to the rules of ANSI SQL and postgresql respecting these rules, this is a requirement to produce valid queries.