title: What is wrong whith this sql command?
body: <p>I am trying to create query which returns the list of students who passed an exam after, At least X number of failures.To achieve this i wrote the following query but i am getting the following error as well:</p>
  
  <blockquote>
    <p>Error in list of values in IN clause. Unable to parse query text.</p>
  </blockquote>
  
  <p>I am sure the list of values in IN clause are fine though what i don't understand is why it is complaining?!
  Here is the query in question :</p>
  
  <pre><code>SELECT  StudentID
      FROM    tblStudents
      WHERE   (Sex = @Sex) AND (StudentID IN
                                          (SELECT StudentID
                                          FROM    tblTest
                                          WHERE   (TestID = @TestID) AND (@APass = 'true') AND (Score IN (27, 28, 29, 30)))
                                          GROUP BY StudentID, TestID
                                          HAVING   (COUNT(*) = 1))/*By this i meant find the the user who has passed the exam (finally)*/
                          AND (StudentID IN
                                          (SELECT  StudentID
                                          FROM     tblTest
                                          WHERE   (TestID = @TestID) AND (Score NOT IN (27, 28, 29, 30)))
                                          GROUP BY StudentID, TestID
                                          HAVING        (COUNT(*) &gt;= @Times))/*And By this i meant only return students which passed the exam after x times of failing it*/
  </code></pre>