title: trouble creating update query using 3 tables mysql
body: <p>I Have closing balances in Akey table and i have pool id in cpp table i want to update value of Bppd key_amount column with akey closing_balance but before 
  that i have to check the default_pool='ACTIVE'  from table cpp</p>
  
  <p>sample tables are mentioned</p>
  
  <pre><code>TABLE Akey (
    `id` int(11) NOT NULL,  
    `serial_key` varchar(82) DEFAULT NULL,
    `closing_balance` double(20,2) DEFAULT '0.00',
    `product_id` int(11) DEFAULT NULL,  
    PRIMARY KEY (`id`)
  ) 
  
  TABLE Bppd(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `pool_id` int(11) DEFAULT NULL,
    `product_id` int(11) DEFAULT NULL,
    `akey_id` int(11) DEFAULT NULL,
    `key_amount` double DEFAULT '0',
    `working_balance` double DEFAULT '0',
     PRIMARY KEY (`id`)
  )
  
  TABLE Cpp (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `akey_id` int(11) DEFAULT NULL,
    `pool_id` int(11) DEFAULT NULL,
    `default_pool` varchar(15) DEFAULT NULL,  
    PRIMARY KEY (`id`)
  )
  </code></pre>
  
  <p>I have Following query</p>
  
  <pre><code>UPDATE `Bppd` ppd
      JOIN AKey kk ON ppd.`akey_id` = kk.`id`
      JOIN `Cpp` pp ON pp.`akey_id` = kk.`id` AND pp.`default_pool` = 'ACTIVE' AND ppd.`akey_id` = pp.`akey_id`
      SET ppd.`key_amount`= kk.`closing_balance`
  </code></pre>