Hey guys,
I have the following query:
This runs just fine, but I need to add more to it.
I want to break down my total count by agency category which is stored in the field AGTY_SYS_CD located in my dsnp.pr01_t_recip_sys.
I just can't see to get it to work especially since I'm dealing with a 3 layered query here. I've tried adding the field to my group by clause, but it returns zero records.
Can anyone help? I want the end result to look like this:
AGENCY DISABILITIES
BBF 13
CAM 223
I have the following query:
Code:
SELECT A.DISABILITIES
FROM (
SELECT count(A.recip_ssn_nbr) as "DISABILITIES" FROM
(SELECT A.recip_ssn_nbr FROM
dsnp.pr01_t_anty_pymt A,
dsnp.pr01_t_recip_sys B
where A.recip_ssn_nbr = B.recip_ssn_nbr
and right(B.voucher_id_cd,1) = 'D'
group by A.recip_ssn_nbr
having min(A.anty_pymt_dt) = '2010-05-01') as A ) as A
This runs just fine, but I need to add more to it.
I want to break down my total count by agency category which is stored in the field AGTY_SYS_CD located in my dsnp.pr01_t_recip_sys.
I just can't see to get it to work especially since I'm dealing with a 3 layered query here. I've tried adding the field to my group by clause, but it returns zero records.
Can anyone help? I want the end result to look like this:
AGENCY DISABILITIES
BBF 13
CAM 223