I've got a view which represents a list of redirects. The view has two fields:
- 'Destination'
- 'Source'
- 'Hash' (an indexed has based on the destination)
I'd like to generate a view which lists destinations along with the number of times a visitor has been redirected to that destination. If I were to write the SQL myself, I'd simply do:
SELECT destination, count(*) as redirects FROM redirects GROUP BY hash
However, no matter what I do I can't get Views to ONLY group by hash. This is what I've done:
- Enabled aggregation (Advanced > Aggregation>
- Enabled COUNT on the 'source' field.
What happens now is that Views COUNT on the 'source' field, but groups on both the 'destination' AND 'hash' field:
SELECT destination, hash, COUNT(source) FROM redirects GROUP BY destination, hash
How do I get Views to only GROUP BY the 'hash' field?