Query error - please check statement

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
Is there anything wrong with this query:

select * from attendancegrid where Activity = 'A&C-Arts & Crafts   1' And [CSW/TitleXX] = 'T' And  {Month = 'October' Or Month = 'November' Or Month = 'December')
Question by:al4629740
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 75

Accepted Solution

Aneesh Retnakaran earned 2000 total points
ID: 26284338
select * from attendancegrid
where Activity = 'A&C-Arts & Crafts   1' And [CSW/TitleXX] = 'T'
And  (Month = 'October' Or Month = 'November' Or Month = 'December')
LVL 13

Expert Comment

by:Philip Pinnell
ID: 26284343

 {Month = 'October' Or Month = 'November' Or Month = 'December')
should be
(Month = 'October' Or Month = 'November' Or Month = 'December')

LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 26284350
also its a better practice to enclose the 'month' in square brackets, like this [month]

select * from attendancegrid
where Activity = 'A&C-Arts & Crafts   1' And [CSW/TitleXX] = 'T'
And  [Month] IN ( 'October' ,'November' ,'December')

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question