title: Opencart - phpMyAdmin Bulk update Special Price
body: <p>I work as administrator in one electronic shop we are using OpenCart eCommerce and recently they asked me to add special price to Bulk products and leave it running for some days. Of course i can change it in admin page one by one. The things is how i can change it through phpMyAdmin.<br>
  ( Opencart Version 2.1.0.1 )</p>
  
  <p>I have 46 products which cost 25€ and i have to add special price to 20€.</p>
  
  <p>Table we have to update price is </p>
  
  <pre><code>oc_product_special
  </code></pre>
  
  <p>and column we have to update is</p>
  
  <pre><code>oc_product_special.price
  </code></pre>
  
  <p>Of course we need products which cost 25€ from table</p>
  
  <pre><code>oc_product
  </code></pre>
  
  <p>to retrieve products from this table and add special price to 20€</p>
  
  <p>The thing is how to connect these two tables so i can add special price which sql query to run so i can achieve this.</p>
  
  <pre><code>oc_product &amp; oc_product_special , update this column oc_product_special.price
  </code></pre>
  
  <p>I 've tried to run this sql query but i receive error</p>
  
  <pre><code>    UPDATE `oc_product_special`.price
      SET `oc_product_special`.price = 16.1290
      FROM `oc_product`
      INNER JOIN `oc_product_special`
            ON `oc_product`.product_id =`oc_product_special`.product_id
      WHERE`oc_product`.price = 20.1612;
  </code></pre>
  
  <p>**** Price is without taxes 25€ / 1,24(tax rate) = 20.1612€</p>
  
  <p>Error 
  <strong>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM <code>oc_product</code> INNER JOIN <code>oc_product_special</code> ON <code>oc_product</code>.product_id =' at line 2</strong></p>
  
  <p>Any help is appreciated
  <a href="https://i.stack.imgur.com/fbxBg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fbxBg.jpg" alt="enter image description here"></a></p>
  
  <p>** <strong>EDIT</strong></p>
  
  <p>Updating my Sql query </p>
  
  <pre><code>UPDATE oc_product_special AS ps 
  INNER JOIN oc_product op ON ps.product_id = op.product_id 
  set ps.price = 16.1290 
  where op.price = 20.1612
  </code></pre>
  
  <p>but the thing is that 0 rows affected. (Query took 0.0003 sec) , if i run select query with these prices i have results.</p>
  
  <pre><code>select *
  from oc_product as op
  where op.price=20.1612
  </code></pre>
  
  <p>Showing rows 0 - 29 (46 total, Query took 0.0010 sec)</p>
  
  <p>***** <strong>Updated 2nd time</strong></p>
  
  <p>Firstly i ran </p>
  
  <pre><code>DELETE FROM `oc_product_special`
  WHERE product_id IN
  (
      SELECT product_id
      FROM oc_product p
      WHERE p.price = 20.1612
  );
  </code></pre>
  
  <p>so i can " remove any existing specials from these products " , this query ran without any issue</p>
  
  <p>After that i tried to ran Insert query</p>
  
  <pre><code>INSERT INTO `oc_product_special` (`product_special_id`, `product_id`, `customer_group_id`, `priority`, `price`, `date_start`,`date_end`)
  VALUES
  (
      SELECT NULL, 78, 1, 0, 16.1290, 0000-00-00, 0000-00-00
      FROM oc_product p
      WHERE p.price = 20.1612
  );
  </code></pre>
  
  <p>I adjusted my data concerning to my table's data. But i receive this error</p>
  
  <p><strong>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT NULL, 78, 1, 0, 16.1290, 0000-00-00, 0000-00-00 FROM oc_product p ' at line 4</strong></p>