title: SQL query causing duplicates
body: <p>To make this simple, I have only listed the relevant fields below:</p>
  
  <pre><code>Table 1 (question_data_table):
   - UserID
   - QuestionID
   - Strength
   - Timestamp
  
  
  Table 2 (user_question_waitlist):
   - UserID
   - QuestionID
   - Timestamp
  </code></pre>
  
  <p>I am running the following query:</p>
  
  <pre><code>INSERT INTO user_question_waitlist (UserID, QuestionID, Timestamp) 
  SELECT UserID, QuestionID, Timestamp FROM question_data_table 
  WHERE Strength &lt;= 0 AND question_data_table.QuestionID NOT IN 
  (SELECT QuestionID FROM user_question_waitlist 
  WHERE question_data_table.UserID = user_question_waitlist.UserID)
  </code></pre>
  
  <p>The issue is, where 5 rows should be inserted into user_question_waitlist. It inserts 31.</p>
  
  <p><a href="https://i.stack.imgur.com/4eRxI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4eRxI.png" alt="enter image description here"></a></p>
  
  <p>Sample data from question_data_table:</p>
  
  <p><a href="https://i.stack.imgur.com/ucOwq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ucOwq.png" alt="Sample Data:"></a></p>
  
  <p>user_question_waitlist data varies a lot, it can be empty for example or contain data for other users.</p>
  
  <p>As an example, using the sample data above if I have the following data in the user_question_waitlist:
  <a href="https://i.stack.imgur.com/BHB07.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BHB07.png" alt="enter image description here"></a></p>
  
  <p>...and then run the query, it inserts 6 rows to produce this:
  <a href="https://i.stack.imgur.com/5Frh0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Frh0.png" alt="enter image description here"></a></p>