Home All Groups Group Topic Archive Search About
Author
17 Mar 2006 2:07 PM
Neo
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

Author
17 Mar 2006 2:14 PM
JT
You 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 + '%'


Show quote
"Neo" <N**@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

AddThis Social Bookmark Button