Reputation: 19
I am trying to run a query that will filter the rows by this expression (If instance name LIKE '1 %' then remove all the rows that has the same EntityKeyID) I removed some columns on the example no place for them
SELECT
EntityKeyID
,[StatusTypeID]
,[InternalNote]
,[InstanceName]
,[DateRequired]
,[LinkName]
,[VendorName]
FROM [ASTRO].[dbo].[vw_EntityServices_Legs]
where (SELECT statustypeID from vw_EntityServices_Legs where InstanceName LIKE '1 %') NOT IN InstanceName
Upvotes: 0
Views: 429
Reputation: 45096
Your words
If instance name LIKE '1 %' then remove all the rows that has the same EntityKeyID
where EntityKeyID not in ( select nl.EntityKeyID
from vw_EntityServices_Legs nl
where nl.InstanceName LIKE '1 %'
)
Upvotes: 1