Monday, March 19, 2012

Compare subsets

Hello,
Does anybody know how to compare the subsets of two columns on different
tables? We have a column A in Table A that we want to compare any 10
characters to column B in Table B. Does anybody know the code to do this?
ThanksYou can join tables using the LIKE comparison operator, but it will result
in a table scan.
select
TableA.*
from TableA
join TableB on TableB.B like '%' + TableA.A + '%'
"Neo" <Neo@.discussions.microsoft.com> wrote in message
news:702ADF0A-B0B2-4E27-B159-87723E8BBD8E@.microsoft.com...
> Hello,
> Does anybody know how to compare the subsets of two columns on different
> tables? We have a column A in Table A that we want to compare any 10
> characters to column B in Table B. Does anybody know the code to do this?
> Thanks

No comments:

Post a Comment