provider_source_value
SUS Inpatient Provider
-
Value copied from
ConsultantCode
-
ConsultantCode
A unique code identifying a care professional CONSULTANT CODE
with counts as (
select
ConsultantCode,
MainSpecialtyCode,
count(*) as SpecialtyFrequency,
row_number() over (
partition by ConsultantCode
order by count(*) desc, MainSpecialtyCode
) rnk
from (
select
ConsultantCode,
MainSpecialtyCode
from [OMOP_QA].[omop_staging].[sus_APC]
where MainSpecialtyCode is not null
and ConsultantCode is not null
) grouped
group by ConsultantCode, MainSpecialtyCode
)
select
ConsultantCode,
MainSpecialtyCode
from counts
where rnk = 1;