SELECT b.businessunitid,
child.guid
FROM businessunit AS b CROSS APPLY (SELECT t.teamid AS guid
FROM team AS t
WHERE t.businessunitid = b.businessunitid
UNION ALL
SELECT s.systemuserid AS guid
FROM systemuser AS s
WHERE s.businessunitid = b.businessunitid) AS child;
When I run this SQL I get the following error:
Thanks in advance for your support.