You are here: Re: sql operator question « MsSQL Server « IT news, forums, messages
Re: sql operator question

Posted by Tom van Stiphout on 12/20/07 04:12

On Wed, 19 Dec 2007 15:12:41 -0800 (PST), ll <barn104_1999@yahoo.com>
wrote:

You probably meant to write:
WHERE Semester IN ('FA-SP', 'FA' , 'SP') AND Out8 = 'N'
which is equivalent to:
WHERE (Semester = 'FA-SP' OR Semester =
'FA' OR Semester = 'SP') AND Out8 = 'N'

It's a matter of operator precedence.

-Tom.



>Hi,
>I'm working with a SQL statement to select from tables and only return
>that which matches the semester AND value of 'N'. The statement below
>does return results according to my criteria, but it also returns all
>of the other results following the semester criteria that don't have a
>value of 'N'.
>Thanks for any help you can provide,
>Louis
>---------------------------------------------
>
>SELECT AMS_CourseCategory.CourseCatDesc,
>AMS_CourseCategory.CourseCatID, AMS_Courses.Class,
>AMS_Courses.Semester, AMS_Courses.TemplateVersion,
>AMS_Courses.YearInProgram, AMS_Courses.CourseID,
>AMS_Courses.Class,AMS_Courses.Semester, AMS_Courses.YearTaught,
>AMS_ContentOverviewObjectiveOutcome.CourseID,
>AMS_ContentOverviewObjectiveOutcome.Objective,
>AMS_ContentOverviewObjectiveOutcome.Out1,
>AMS_ContentOverviewObjectiveOutcome.Out9,
>AMS_ContentOverviewObjectiveOutcome.Out8,
>AMS_ContentOverviewObjectiveOutcome.OutP15,
>AMS_ContentOverview.Complete FROM AMS_ContentOverviewObjectiveOutcome
>INNER JOIN AMS_Courses ON AMS_ContentOverviewObjectiveOutcome.CourseID
>= AMS_Courses.CourseID INNER JOIN AMS_CourseCategory ON
>AMS_Courses.CourseCatID = AMS_CourseCategory.CourseCatID INNER JOIN
>AMS_ContentOverview ON AMS_Courses.CourseID =
>AMS_ContentOverview.CourseID WHERE Semester = 'FA-SP' OR Semester =
>'FA' OR Semester = 'SP' AND Out8 = 'N' order by AMS_Courses.CourseCatID

 

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

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