Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE #Customers ( AccountNumber nvarchar(20))
- CREATE TABLE #Phones ( Number nvarchar(30))
- INSERT INTO #Customers (AccountNumber)
- SELECT AccountNumber
- FROM CustomerTable
- WHERE
- (CustomerTable.PhoneNumber IN (SELECT DISTINCT Number FROM #Phones))
- OR
- (CustomerTable.PhoneNumber2 IN (SELECT DISTINCT Number FROM #Phones))
- GO
Add Comment
Please, Sign In to add comment