title: Deleting rows from single Table using inner Join
body: <p>I am having difficulties removing rows from my MySQL database.  I have two tables that I am Joining.  Joining may not be the best solutions and I am definitely open to suggestions. the tables are as follows</p>
  
  <pre><code>     Table a                                     
  </code></pre>
  
  <p>part_number, cat_code,description        </p>
  
  <pre><code>      Table b
  </code></pre>
  
  <p>part_number, cat_code,description</p>
  
  <p>Table b is the correct table its contents has recently been updated. Table b only has a single product line.  Table a has All product Lines that the company currently and previously made.Table a has old data and part_numbers that are duplicated and associated with multiple cat_codes.</p>
  
  <p>Properly the cat_codes should have a one to Many relationship with part_numbers.For Example part_number 123,456,and 789 can have a cat_code of 1A.The primary key of both tables are part_number+cat_code</p>
  
  <p>When I run this select statement I get the output of the unique identifiers I need to remove from table a.</p>
  
  <pre><code>SELECT CONCAT(a.part_number,a.cat_code)
  FROM
  b
  INNER JOIN
  a 
  WHERE
  a.part_numer = b.part_number
  AND a.cat_code != b.cat_code
  </code></pre>
  
  <p>But when I try to use that select statement in a DELETE FROM Statement it doesn't work.  Here is the broken statement.</p>
  
  <pre><code>DELETE FROM
  a
  WHERE
  CONCAT(part_number,cat_code) IN (SELECT CONCAT(a.part_number,a.cat_code)
  FROM
  b
  INNER JOIN
  a 
  WHERE
  a.part_numer = b.part_number
  AND a.cat_code != b.cat_code)
  </code></pre>
  
  <p>Any Help would be appreciated thanks</p>