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!

Get Column value count

BagiyaMay 14 2008 — edited May 15 2008
Hi All,


this is a my test table stucture.

create table testtab
(
emp_id number (10),
day_01 varchar2 (1),
day_02 varchar2 (1),
day_03 varchar2 (1),
day_04 varchar2 (1));

I'm having data stord as follows

SELECT * FROM TESTTAB;

EMP_ID DAY_01 DAY_02 DAY_03 DAY_04
------- ------- ------- ------- -------
68962 A D A A
68965 D D D A
68962 A A A A
68965 D D A A



I wanted to get a output as follows.

Note: - Day_01 to Day_05 values may vary. Not always A and D. some time user may add some other character also. Count should be calculated dynamically



EMP_ID A-Count D -Count
-------- --------- --------
68962 7 1
68965 3 5

Thanking You
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 12 2008
Added on May 14 2008
8 comments
511 views