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
[Back to original message]
|