Reply to Re: Link two tables using partial word match

Your name:

Reply:


Posted by Alex Kuznetsov on 01/18/07 17:19

SQL Learner wrote:
> Hi All,
>
> I need to link two tables using partial word match.
>
> How can I write a SQL statement to do so? (I am using MS-Access.)
>
> Table One: [Table Name: tblStreet] [Field Name: Street]
> 123 ABC Street
> 124 ABC Street
> 125 ABC Street
> 1 XYZ AVE
> 2 XYZ AVE
> 3 XYZ AVE
> 10 CBS Street
> 11 CBS Street
> 12 CBS Street
> 100 Apple Road
> 101 Apple Road
> 102 Apple Road
>
> Table Two: [Table Name: tblWord] [Field Name: Word]
> ABC
> CBS
>
> The output should be:
>
> 123 ABC Street
> 124 ABC Street
> 125 ABC Street
> 10 CBS Street
> 11 CBS Street
> 12 CBS Street
>
> Could this be done?
>
> Thank you in advanced.
>
> - Grasshopper -


SELECT t.* FROM tblStreet t WHERE EXISTS(SELECT 1 FROM tblWord w WHERE
t.Street LIKE '%'+Word+'%')

-----------------------
Alex Kuznetsov
http://sqlserver-tips.blogspot.com/
http://sqlserver-puzzles.blogspot.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация