You are here: Re: Update table using partial word match « MsSQL Server « IT news, forums, messages
Re: Update table using partial word match

Posted by Alex Kuznetsov on 01/22/07 18:36

SQL Learner wrote:
> Thanks again, Alex.
>
> I am having problem put the SQL in Access. Could you tell me the logic
> of the select statement?
>
> (SELECT MIN(Value) FROM TblWord_Number WHERE Street LIKE '%'+Word+'%'
> AND Street LIKE CAST(Number AS VARCHAR(50))+'%')
>
> Why are we using Min(Value) and what does "CAST(Number AS
> VARCHAR(50))+'%')" mean and do?
>
> I got your partial matching SQL code as follow:
>
> ========================
> SELECT t.*
> FROM tblStreet AS t
> WHERE (((Exists (SELECT 1 FROM tblWord w WHERE t.Street LIKE
> '*'+Word+'*'))<>False));
> ========================
>
> I seems a little different from your new one.
>
> This seems like a difficult query. Please help.
>
> - Grasshopper -

If Number column is numeric, I cannot concatenate '%' to it directly, I
need to convert is to character type first.
Because the subquery without MIN() can return more than one value and
blow up, I need to restrict it to one value. i could use TOP 1 instead
of MIN(). You might get better help an an Access newsgroup.

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

 

Navigation:

[Reply to this 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

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