You are here: Re: LIKE and IN can I combine « MsSQL Server « IT news, forums, messages
Re: LIKE and IN can I combine

Posted by Ross Presser on 10/10/05 22:07

On 10 Oct 2005 10:19:34 -0700, Razvan Socol wrote:

> SELECT * FROM employees e
> WHERE EXISTS (
> SELECT * FROM (
> SELECT 'C' AS Prefix
> UNION ALL SELECT 'D'
> UNION ALL SELECT 'F'
> ) x WHERE e.LastName LIKE x.Prefix+'%'
> )

Is there any good reason why you wouldn't do this variation:

SELECT * FROM employees e
WHERE EXISTS (
SELECT * FROM (
SELECT 'C%' AS Pattern
UNION ALL SELECT 'D%'
UNION ALL SELECT 'F%'
) x WHERE e.LastName LIKE x.Pattern
)

 

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

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