Payers have PAYER_IDS and PAYER_TYPE_CODES.
Looking for Payers that have two PAYER_TYPE_CODES
where those two PAYER_TYPES_CODES are 17001 and 17002.
Tried the query copied herewith below.
Returns all PAYER_IDS w PAYER_TYPE__CODES 17002
not just the PAYER_IDS w PAYER_TYPE__CODES 17002
and PAYER_TYPE__CODES 17001
Tried the query copied below with AND instead of OR
but this returned no rows.
Also tried WHERE IN (17001, 17002) Returns similar to OR.
I think I have done this using paretheses but can't remember.
Allen Pitts, Dallas Texas
With cte as (
group by PAyer_ID
having Count(*) =2
order by PAYER_ID)
join CCM_PAYER_TYPE PAT on PAT.payer_id =CTE.payer_id
where (PAYER_TYPE_CODE = 17001 or
PAYER_TYPE_CODE = 17002)
order by 2, 3