title: compare two tables's data in MySQL
body: <p>There are two tables</p>
  
  <h2>Table 1</h2>
  
  <pre><code>select * from manage_tcp;
  +----+----------+--------+
  | id | services | statut |
  +----+----------+--------+
  |  2 |     1433 | up     |
  |  2 |     3389 | up     |
  |  3 |     3389 | down   |
  |  3 |     1433 | down   |
  |  9 |     3389 | up     |
  |  8 |     3389 | up     |
  |  7 |     1433 | up     |
  |  6 |     3389 | up     |
  |  5 |     3389 | up     |
  |  4 |     3389 | up     |
  | 10 |     1433 | up     |
  | 11 |     1433 | up     |
  | 12 |     3389 | up     |
  | 13 |     1433 | up     |
  | 14 |     3389 | up     |
  | 15 |     1433 | up     |
  | 16 |     3389 | up     |
  | 17 |     1433 | up     |
  | 18 |     3389 | up     |
  | 19 |     1433 | up     |
  | 20 |     3389 | up     |
  | 21 |     1433 | up     |
  | 24 |     1433 | up     |
  | 23 |     3389 | up     |
  | 25 |     3389 | up     |
  | 26 |     1433 | up     |
  | 29 |     1433 | up     |
  | 28 |     3389 | up     |
  | 30 |     3389 | up     |
  | 31 |       80 | up     |
  | 32 |     3389 | up     |
  | 33 |       80 | up     |
  | 34 |     3389 | up     |
  | 35 |       80 | up     |
  +----+----------+--------+
  34 rows in set (0.00 sec)
  </code></pre>
  
  <h2>Table 2</h2>
  
  <pre><code>mysql&gt; select * from manage_host;
  +----+------------+-------------+--------+-------+--------------+----------+------+
  | id | uptime     | type        | statut | group | thresold_ref | thresold | mail |
  +----+------------+-------------+--------+-------+--------------+----------+------+
  |  2 |  277248529 | win2003.png | up     |     4 |            1 |        0 | NULL |
  |  3 |  277277471 | win2003.png | prob   |     4 |            1 |        0 | NULL |
  |  4 |  346159833 | win2003.png | up     |     4 |            1 |        0 | NULL |
  |  5 |  930205491 | win2003.png | up     |     5 |            1 |        0 | NULL |
  |  6 | 3805663007 | win2003.png | up     |     5 |            1 |        0 | NULL |
  |  7 |         -1 | win2003.png | up     |     4 |            1 |        0 | NULL |
  |  8 |   29413867 | win2003.png | up     |     5 |            1 |        0 | NULL |
  |  9 |  981986401 | win2003.png | up     |     5 |            1 |        0 | NULL |
  | 10 |         -1 | win2003.png | up     |     5 |            1 |        0 | NULL |
  | 11 |         -1 | win2003.png | up     |     5 |            1 |        0 | NULL |
  | 12 | 2230787611 | win2003.png | up     |     7 |            1 |        0 | NULL |
  | 13 |         -1 | win2003.png | up     |     7 |            1 |        0 | NULL |
  | 14 | 1004161923 | win2003.png | up     |     8 |            1 |        0 | NULL |
  | 15 |         -1 | win2003.png | up     |     8 |            1 |        0 | NULL |
  | 16 | 1592294954 | win2003.png | up     |     8 |            1 |        0 | NULL |
  | 17 |         -1 | win2003.png | up     |     8 |            1 |        0 | NULL |
  | 18 | 1449216250 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 19 |         -1 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 20 | 3461945234 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 21 |         -1 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 23 | 3461946968 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 24 |         -1 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 25 | 3462022562 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 26 |         -1 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 35 | 3318333401 | win2003.png | up     |     6 |            1 |        0 |      |
  | 28 | 3461879984 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 29 |         -1 | win2003.png | up     |     4 |            1 |        0 | NULL |
  | 30 | 1872950109 | win2003.png | up     |     6 |            1 |        0 | NULL |
  | 31 | 1872950125 | win2003.png | up     |     6 |            1 |        0 | NULL |
  | 32 | 1955232033 | win2003.png | up     |     6 |            1 |        0 | NULL |
  | 34 | 3318333401 | win2003.png | up     |     6 |            1 |        0 |      |
  | 33 | 1955232049 | win2003.png | up     |     6 |            1 |        0 | NULL |
  +----+------------+-------------+--------+-------+--------------+----------+------+
  32 rows in set (0.00 sec)
  </code></pre>
  
  <p>I'd like to compare those two tables above and to get the results in table 1 but not in table 2 like: (<strong>this is the result i want</strong>)</p>
  
  <pre><code>+----+----------+--------+
  | id | services | statut |
  +----+----------+--------+
  |  2 |     1433 | up     |
  |  3 |     3389 | down   |
  |  3 |     1433 | down   |
  +----+----------+--------+
  </code></pre>
  
  <p>I've tried </p>
  
  <pre><code>SELECT a.*,b.* 
  FROM manage_tcp as a 
  LEFT JOIN manage_host as b 
  USING(id,statut) 
  WHERE b.id is null;
  </code></pre>
  
  <p>but I got </p>
  
  <pre><code>+----+----------+--------+
  | id | services | statut |
  +----+----------+--------+
  |  3 |     3389 | down   |
  |  3 |     1433 | down   |
  +----+----------+--------+
  </code></pre>
  
  <p>it's not what I want. </p>
  
  <p>Thanks a lot!</p>