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!

distinct count using lookup table

MarkFoldenNov 17 2008 — edited Nov 18 2008
How can I get a distinct count of column values using a different table?

Let's say I want to get a distinct count of all "company_name" records in table "emp" that corespond (match) with "lookup" table, "state" category.

What I want is to find counts for all companies that have a value of "california" in the "state" column of the "lookup" Table. I want the output to look like:

Sears 17
Pennys 22
Marshalls 6
Macys 9

I want the result to show me the company names dynamically as I don't know what they are, just that they are part of the "state" group in the lookup Table. Does this make sense?

M
This post has been answered by Sentinel on Nov 17 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2008
Added on Nov 17 2008
11 comments
492 views