Basicaly, I want to select all items in tbl1 WHERE RANGE_DEP in tbl2 match RANGE in tbl1
tbl1
tbl2
I tried with
Declare @Range nvarchar(100) = SELECT RANGE FROM tbl1
SELECT * FROM tbl2 WHERE (SELECT RANGE_DEP FROM tbl1 WHERE DEPARTMENT = D1) IN (SELECT * FROM STRING_SPLIT(@Range, ','))
but I am pretty sure is not the corect way. Can you help, please?