You are here: Re: OR in the WHERE Clause? « MsSQL Server « IT news, forums, messages
Re: OR in the WHERE Clause?

Posted by Mike C# on 07/07/06 04:30

The WHERE clause does recognize the OR operator, as in:

WHERE SupportedState1 = 'CA' OR SupportedState2 = 'WA'

Like the others pointed out though, what you should do is look at
re-designing these tables. Ideally you should have a separate "supported
state" table related to the candidates table by the candidate table primary
key. This turns your queries into a simple inner join without all the
explicit "OR" logic, and also allows you to store as many states per
candidate as you wish. It also helps enforce referential integrity. So if
a candidate only has one or two supported states you won't waste all that
extra time and programming logic trying to determine this. Also if your
requirements change in the future, like if the number of supported states
suddenly jumps up to 10 per candidate, you won't have to re-design all of
your tables and queries.

 

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

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