I have the following tables:
- Contact - This has client SSN info
- Program - This has program info that the client is enrolled in
----- Programs with same SSN
select MAX(p.name)
from raw_prod.bedrock.contact c
join raw_prod.bedrock.program_c p on p.account_id_c = c.account_id
HAVING COUNT(*) > 1;
Desired output: Different program names with same SSNs
Program Name ---------- SSN
P - 0001 --------- 000-00-0000
P - 0002 -------- 000-00-0000
P - 0003 --------- 111-11-1111
P - 0004 ---------- 111-11-1111
P - 0005 ----------- 111-11-1111
P - 0006 ----------- 222-22-2222
P - 0007 ------------ 222-22-2222
Sorry about the formatting issues.
The query should give me P- 0001 and P- 0002 as these programs have same SSNs
Please let me know if more info is needed. I am new to SQL :(