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 count

567066Apr 2 2009 — edited Apr 2 2009
Hi gurus,
Need some guidance/advice / help from you..

Basically what I want is for each/any application_id if there are mutiple pgm_typ_cd , it has to be counted as 1 and the mainly want to show the pgm_typ_cd in the output.

The result I want is shown below

APP_ID PGM_TYP_CD COUNT(*)
83931 CW 1
84101 GA 1

The result I get currently for the below query is shown below
*****************************
select app_id,pgm_typ_cd,count(*)
from cs_pgm
where cs_id = '1B00215'
and eff_end_dt is null
and app_id is not null
and trunc(sts_dt) between :p_start_date1 and :p_end_date1
group by app_id,pgm_typ_cd

APP_ID PGM_TYP_CD COUNT(*)
83931 FS 1
83931 EX 1
84101 GA 1
****************************

Thanks
Sheik
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2009
Added on Apr 2 2009
11 comments
623 views