I am joining a metric table to a client listing. Currently when joined, the joined column populates for each client on all rows.
The goal is to only have the metric populate once per client grouping (hsp.PROV_ID). - SECOND IMAGE
select hsp.PROV_ID, HSP.id from hsp_client hsp
left join(select vat.ASGN_PROV_ID, sum(vat.ASGN_DFI_CNT) as 'Deficiency Count', sum(vat.DLQ_DFI_CNT) as 'Delinquent Count' from V_DT_PROV_ASGN_METRICS vat
where VAT.PAT_CLASS_C IN ('101', '102','104')
and VAT.METRIC_DATE = Convert(DATE, GetDate())
--and DEF_ID IS NULL
and vat.DEF_TYPE_C not in ('9')
group by vat.ASGN_PROV_ID,vat.ASGN_DFI_CNT,vat.DLQ_DFI_CNT
) vtt on vtt.ASGN_PROV_ID =hsp.PROV_ID
group by hsp.PROV_ID, hsp.id