How to get a distinct count of multiple columns
838406Feb 9 2011 — edited Feb 10 2011I've done this before and I'll be darned why I can't recall this.
Table with 3 columns with the primary key defined in column a.
Row a b c
num.
1 020 how abc
2 030 why def
3 010 not ghi
4 040 how abc
5 050 yes def
6 060 why def
So what I want is a count of the unique values for columns b and c as if b and c were actually one field.
So the result of the query would be:
Count = 4 unique rows.
Hopefully I'm making some sort of sense. It's a bit much to ask about the number of occurrences of each duplicate value, I'm sure just getting count of the unique rows of the non-indexed rows will be sufficient. Since the query is meant to be universal for multiple columns of numeric and alphanumeric data and can be expanded for multiple columns, I am simply trying to get a basic skeleton that works for an "on the fly" analysis.