I need an approach to pass values from a SELECT-Statement in a variable in SQL server because I have a lot of checks before the procedure returns a result.
Firstly I have a SELECT-Statement that checks whether the IDs aren't in a group 'US'.
// 1. check:
SELECT
g.artID
FROM
dbo.G_FID g
INNER JOIN
dbo.MasterData s
ON
g.WKN = s.WKN
WHERE
s.ID <> "US"
All artIDs they are not in the US- the group will check for the next SELECT-Statement:
// 2. check:
SELECT
g.artID
FROM
dbo.G_FID g
WHERE
(g.FID='68A')
OR
(g.FID='73' AND g.VALUE IN ('04', '07', '09', '11', '13', '14', '15'))
the result of this check continues to the next check and so on. Could anyone give me an example how to handle this issue?