Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Multi Parameter AND Statement

Author  Topic 

Pistris
Starting Member

5 Posts

Posted - 2008-05-27 : 12:47:40
Is it possible for an AND statement to take mulitple parameters? See below code:

SELECT tblQuestion.Question, tblAnswer.Answer

FROM (tblAnswer INNER JOIN tblQuestion ON tblAnswer.QuestionID = tblQuestion.ID)

WHERE (tblAnswer.StateID = ?) AND (tblAnswer.QuestionID = 14)

Is something like this possible?:
AND (tblAnswer.QuestionID = 14, 26)

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 12:51:38
AND tblAnswer.QuestionID IN (14, 26)

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

Pistris
Starting Member

5 Posts

Posted - 2008-05-27 : 13:00:08
Great...thanks tkizer. Just what I needed.
Go to Top of Page
   

- Advertisement -