次のような条件付き結合を実行できる方法はありますか:
CREATE TABLE #Entity
(
[AutoID] [int],
[Code] [nvarchar](50) NOT NULL,
)
INSERT #Entity
EXEC Entity_GetEntitiesByUserId @UserID
DECLARE @Condition bit = 0
SELECT * FROM [Stuff] s
IF @Condition = 1 BEGIN
INNER JOIN
(
SELECT Code as eCode from
#Entity
) e
ON E.eCode = s.EntityCode
END
WHERE DeletedBy IS NULL
ありがとう。