Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get a distinct count of multiple columns

838406Feb 9 2011 — edited Feb 10 2011
I'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.
This post has been answered by 834293 on Feb 9 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2011
Added on Feb 9 2011
5 comments
14,170 views