title: MySQL return inverse? Results of a search or results NOT containing
body: <p>A complex one here? (for me at least). I have a table called <code>tickets</code>, with the <code>id</code> column being the unique key. I have another table called <code>Labels</code>, which doesn't have a unique key (from the looks of it). In <code>Tickets</code> we store ticket information (messages, who made the ticket etc). We can add a label to a ticket when we create it so that we can search for tickets with those labels e.g. "review later".</p>
  
  <p>What I am trying to do, is a reverse type query e.g. show me all tickets that don't have a specific label associated with it e.g. Don't show me any tickets with "review later". IF A TICKET DOESN'T HAVE ANY LABELS NOTHING IS PUT IN THE LABEL TABLE. I just can't get any type of query I write, by hand or with a query builder to work. </p>
  
  <p>I'm my image, you can see <code>Tickets.id</code> has 174 against it, which is also shown in <code>Labels.ticket_id 174</code> with 2 x Labels set against it. </p>
  
  <p><img src="https://i.imgur.com/Vewmh.jpg" alt=""></p>
  
  <p>No matter what query, join, does, does not, etc I try, I either get back no results OR for some strange reason, I still get <code>ticket 174</code> showing up.</p>
  
  <p>Here is the most simple query I have tried... However, I think I've tried about 30 iterations by now from simple to very complex.</p>
  
  <pre><code>SELECT tickets.id
  FROM
    tickets, labels_tickets
  WHERE
    tickets.id &lt;&gt; labels_tickets.ticket_id
  GROUP BY
    tickets.id
  </code></pre>
  
  <p>Can anyone suggest why this wouldn't work or think of any method to build a statement that says:</p>
  
  <p>Show me all tickets.id from tickets that don't have the label "MyLabel" or doesn't have a value at all in the Labels table.</p>
  
  <p>Many thanks!</p>