title: insert into table only if not exist on other table
body: <p>I'm trying to do the following thing: 
  I have two tables: ReportImage (imageId, reportId, counter)
                     and userReportedImages (imageId, userId)</p>
  
  <p>I want that every user will be able to report an image only once - this means that first I want to check if there is a row in 'userReportedImages' with the values (imageId, userId) if so do nothing, else create a row in 'ReportImage' with the values (imageId, reportId, counter), if such row already exist (other user reported that image) then I want to raise the counter.</p>
  
  <p>so far before checking for same user report I had the following statement:</p>
  
  <pre><code>INSERT INTO ReportImage VALUES (imageId,reportId,1) ON DUPLICATE KEY UPDATE counter = counter+1
  </code></pre>
  
  <p>this statement is working fine.</p>
  
  <p>I tried to change this statement to first check if the row exist on the other table, but I didn't manage to do it, can you help me? </p>