I know I can use:
@FirstName nvarchar(50)
SELECT
c.FullName
FROM
dbo.tblCONTACTS c
WHERE
@FirstName IN("Bob", "Robert", "Bobby")
but...
How can I get the same results if I have a table of like names and each
row contains a group of similar names:
tblLIKENAMES
ID FirstNames
1 Bob, Robert, Bobby, Rob, Roberto
2 Frank, Franky, Francis
3 etc...
Where a user enters
@FirstName nvarchar(50), = "bob"
@LastName nvarchar(50) = "smith"
SELECT
c.Fullname
FROM
dbo.tblCONTACTS c
WHERE
c.LastName = @LastName
AND
/* Foo code: */
c.FirstName IN (SELECT FirstNames FROM tblLIKENAMES WHERE FirstNames
LIKE '%' + @FirstName + '%')
thanks,
lq
@FirstName nvarchar(50)
SELECT
c.FullName
FROM
dbo.tblCONTACTS c
WHERE
@FirstName IN("Bob", "Robert", "Bobby")
but...
How can I get the same results if I have a table of like names and each
row contains a group of similar names:
tblLIKENAMES
ID FirstNames
1 Bob, Robert, Bobby, Rob, Roberto
2 Frank, Franky, Francis
3 etc...
Where a user enters
@FirstName nvarchar(50), = "bob"
@LastName nvarchar(50) = "smith"
SELECT
c.Fullname
FROM
dbo.tblCONTACTS c
WHERE
c.LastName = @LastName
AND
/* Foo code: */
c.FirstName IN (SELECT FirstNames FROM tblLIKENAMES WHERE FirstNames
LIKE '%' + @FirstName + '%')
thanks,
lq
Comment