Попробуйте это ниже
DECLARE @TableA AS TABLE ( ParLab VARCHAR(100), Mcode VARCHAR(100), Entry VARCHAR(100))
INSERT INTO @TableA
SELECT 'L;58' ,'9LL','948487' UNION ALL
SELECT 'L;58' ,'2AN','e@y.com' UNION ALL
SELECT 'L;80' ,'9LL','938745' UNION ALL
SELECT 'L;58' ,'3B2','563467' UNION ALL
SELECT 'T;80' ,'2AN','d@g.com' UNION ALL
SELECT 'T;88' ,'9LL','827120' UNION ALL
SELECT 'T;88' ,'9LL','k@g.com' UNION ALL
SELECT 'A;7;2','2AN','928233'
DECLARE @TableB AS TABLE ( Customer VARCHAR(100), Lab INT)
INSERT INTO @TableB
SELECT 'Lynn' ,58 UNION ALL
SELECT 'Laurence' ,80 UNION ALL
SELECT 'Emmanuel' ,88
SELECT b.Customer,
b.Lab,
MAX(CASE WHEN ISNUMERIC(Entry)=1 THEN Entry END)As Tel,
MAX(CASE WHEN ISNUMERIC(Entry)<>1 THEN Entry END) AS Email
FROM
(
SELECT ParLab,
Mcode,
[Entry],
CASE WHEN LEN(ParLab)-LEN(REPLACE(ParLab,';','')) = 1
THEN SUBSTRING(ParLab,CHARINDEX(';', ParLab)+1,LEN(ParLab))
ELSE NULL END AS Lab
FROM @TableA
) AS A
RIGHT JOIN @TableB B
ON a.Lab = b.Lab
GROUP BY b.Customer,b.Lab
Результат
Customer Lab Tel Email
*******************************
Lynn 58 948487 e@y.com
Laurence 80 938745 d@g.com
Emmanuel 88 827120 k@g.com