title: sql joining three tables using inner joins
body: <p>in my database I have 3 tables named <code>items</code>, <code>manufacturers</code> and <code>items_manufacturers</code>. <code>manufacturers</code> has a HAS:MANY relation with <code>items_manufacturers</code></p>
  
  <p>My <code>items</code> table</p>
  
  <pre><code> +---------------+--------------+------+-----+---------+----------------+
  | Field         | Type         | Null | Key | Default | Extra          |
  +---------------+--------------+------+-----+---------+----------------+
  | id            | bigint(20)   | NO   | PRI | NULL    | auto_increment |
  | code          | varchar(25)  | NO   | MUL | NULL    |                |
  | item_category | varchar(100) | NO   |     | NULL    |                |
  | item_desc     | varchar(500) | NO   |     | NULL    |                |
  | reorder_point | int(11)      | NO   |     | NULL    |                |
  | unit          | varchar(45)  | NO   |     | NULL    |                |
  +---------------+--------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>My <code>manufacturers</code> table </p>
  
  <pre><code>+------------+--------------+------+-----+---------+----------------+
  | Field      | Type         | Null | Key | Default | Extra          |
  +------------+--------------+------+-----+---------+----------------+
  | id         | bigint(20)   | NO   | PRI | NULL    | auto_increment |
  | code       | varchar(25)  | NO   |     | NULL    |                |
  | name       | varchar(250) | NO   |     | NULL    |                |
  | address    | varchar(750) | NO   |     | NULL    |                |
  | contact_no | varchar(50)  | NO   |     | NULL    |                |
  +------------+--------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>My <code>items_manufacturers</code> table</p>
  
  <pre><code>+-----------------+---------------+------+-----+---------+----------------+
  | Field           | Type          | Null | Key | Default | Extra          |
  +-----------------+---------------+------+-----+---------+----------------+
  | id              | bigint(20)    | NO   | PRI | NULL    | auto_increment |
  | item_id         | bigint(20)    | NO   | MUL | NULL    |                |
  | manufacturer_id | bigint(20)    | NO   | MUL | NULL    |                |
  | unit_cost       | decimal(20,2) | NO   |     | NULL    |                |
  | vendor_id       | bigint(20)    | NO   |     | NULL    |                |
  +-----------------+---------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>In my result table I want <code>items_id</code>, <code>items_desc</code>, <code>name</code> of manufacturer from <code>manufacturers</code> table and <code>manufacturer_id</code>. The relation I have is </p>
  
  <pre><code>items.id=items_manufacturers.item_id and
  manufacturers.id=items_manufacturers.manufacturer_id.
  </code></pre>
  
  <p>I tried using inner joins for three tables but not working.
  The query  I tried</p>
  
  <pre><code>select 
    items_manufacturers.id,
    items.item_desc,
    item_manufacturers.manufacturer_id,
    manufacturer.name 
  from items_manufacturers 
  INNER JOIN items ON items_manufacturers.item_id=items.id 
  INNER JOIN manufacturers ON items_manufacturers.manufacturer_id=manufacturers.id 
  </code></pre>
  
  <p>Anybody kindly help me with this, I am stuck up from a long time</p>