You are here: Re: problem with filtering data « MsSQL Server « IT news, forums, messages
Re: problem with filtering data

Posted by Hugo Kornelis on 01/14/06 22:58

(comp.databases.mysql removed from groups list)

On 14 Jan 2006 07:55:01 -0800, hubmei75@web.de wrote:

(snip)
>The only idea I have is to concatenate the fields to
>simulate the compound index to be able to do
>
> where name+"~"+city>="Olson~Dublin"
>
>not to forget to struggle with null fields to get
>the right results. This slows down the simple query
>dramatically.
>
>This seems to be a complicated solution for a simple
>problem, given the fact, that the index is already
>available at the server.
>
>Does anyone has an idea or suggestion?

Hi Hubert,

Here's a version that makes optimal use of existing indexes on name or
name + city columns:

WHERE name >= 'Olson'
AND ( name > 'Olson OR city > 'Dublin' )

--
Hugo Kornelis, SQL Server MVP

 

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

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