-1
SELECT person.first_name, person.last_name, meeting.meeting_id, meeting.meeting_start, meeting.meeting_end
-> FROM person INNER JOIN (meeting
-> INNER JOIN person_meeting ON meeting.meeting_id = person_meeting.meeting_id)
-> ON person.person_id = person_meeting.person_id
-> WHERE person.person_id IN (SELECT person_id
-> FROM person_meeting
-> WHERE meeting_id IN ((SELECT meeting_id
-> FROM meeting
-> WHERE meeting_id NOT IN (SELECT meeting_id
-> FROM meeting
-> WHERE meeting_start >'2016-12-25 00:00:00')));

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ri ght syntax to use near '' at line 11

closed as off-topic by Michael Green, joanolo, mustaccio, James Anderson, McNets Jun 25 '17 at 19:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Michael Green, joanolo, mustaccio, James Anderson, McNets
If this question can be reworded to fit the rules in the help center, please edit the question.

  • At a guess I'd say the error's on line 2 with the bracket between JOIN and MEETING. Not a MySQL userm though. – Michael Green Jun 24 '17 at 9:56
  • Rewrite the query to avoid using IN ( SELECT ... ) . Usually such can be converted into JOINs. – Rick James Jul 4 '17 at 17:35
1

Your SQL query has unbalanced parenthesis. You open 5 parenthesis, you close 4. This would solve it:

SELECT 
    person.first_name, person.last_name, meeting.meeting_id, meeting.meeting_start, meeting.meeting_end
FROM 
    person 
    INNER JOIN 
    (
        meeting
        INNER JOIN person_meeting 
             ON meeting.meeting_id = person_meeting.meeting_id
    )
    ON person.person_id = person_meeting.person_id
WHERE 
    person.person_id IN 
    (
        SELECT 
            person_id
        FROM 
            person_meeting
        WHERE 
            meeting_id IN 
            (
                (SELECT 
                     meeting_id
                 FROM 
                      meeting
                 WHERE 
                      meeting_id NOT IN 
                      (
                          SELECT 
                              meeting_id
                          FROM 
                              meeting
                          WHERE 
                               meeting_start > '2016-12-25 00:00:00'
                      )
                 )
           )
      ) ;

Plus: your query is more complicated that it needs be. You seem to look for all meetings attended by people who attended meetings NOT starting later than 20161225. This can be achieved with one less level of subquery, plus some simplification at the top JOINs:

SELECT 
    person.first_name, person.last_name, meeting.meeting_id, meeting.meeting_start, meeting.meeting_end
FROM 
    person 
    JOIN person_meeting ON person_meeting.meeting_id = person.person_id
    JOIN meeting ON meeting.meeting_id = person_meeting.meeting_id
WHERE     
    person.person_id IN 
    (SELECT  /* s2: Persons NOT having attended meetings NOT starting {1} */
        person_id
    FROM 
        person_meeting
    WHERE 
        meeting_id IN 
        (SELECT /* s1: Meetings NOT starting later than 20161225 {1} */
            meeting_id
        FROM 
            meeting
        WHERE 
            meeting_start <= /* reversed! */  '2016-12-25 00:00:00'
        )
   ) ;

Check it all at dbfiddle here

Not the answer you're looking for? Browse other questions tagged or ask your own question.