Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2012
    Posts
    17

    Unanswered: MySQL UPDATE issues

    Hello,

    I'm working with the 1.5.1 version of PrestShop in case anyone is familiar with it. I've included my original message in the Presta forums below.

    So, it seems that the quantity field is no longer used in the product table and is instead pulled from the stock_available table. Thanks for the hour of total confusion Presta developers. :angry:

    I'm trying to update the quantities using a script outside of Presta (dropshipping - I pull the stock availability from them daily). It was working fine until the quantity field moved.

    Here's the SQL I'm trying to run:

    Code:
    UPDATE stock_available
    SET stock_available.quantity = 1
    FROM stock_available
    INNER JOIN product
    ON stock_available.id_product = product.id_product
    WHERE product.supplier_reference = 'BKFLAGPL';
    The real script uses variables for stock_available.quantity and product.supplier_reference. I'm just trying to get the basic SQL to work.

    I get the following error:

    #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 stock_available INNER JOIN product ON stock_available.id_product = product.' at line 3

    Any ideas on where I'm going wrong?
    Any and all help would be much appreciated.

  2. #2
    Join Date
    Mar 2004
    Posts
    480
    you can't make up your own syntax. the FROM clause is incorrect.

    Try the following
    Code:
    UPDATE 
      stock_available, product
    SET 
      stock_available.quantity = 1
    WHERE 
      stock_available.id_product = product.id_product
    AND 
      product.supplier_reference = 'BKFLAGPL';

  3. #3
    Join Date
    Oct 2012
    Posts
    17
    Works perfectly. Thanks a zillion.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by guelphdad View Post
    you can't make up your own syntax.
    true

    but i'm guessing he didn't just make it up on his own -- that's the way SQL Server does it

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •