- How to exclude Cross apply to make it conditional
- S.ID IN(SELECT DISTINCT ServiceEntryID
- FROM
- ServiceEntryPart M
- CROSS APPLY
- dbo.SplitStrings_Moden(M.ServiceTypeIDs, N',') M2
- JOIN dbo.SplitStrings_Moden(@ServiceTypes, N',') P ON M2.Item = P.Item
- INNER JOIN Part ON M.PartID = Part.ID
- WHERE
- @ActivePart is null or @ActivePart = Part.Active))