MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 14th, 2012, 02:06 PM
rseigel rseigel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 rseigel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 48 sec
Reputation Power: 0
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.

Quote:
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:

Quote:
#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.

Reply With Quote
  #2  
Old October 14th, 2012, 02:20 PM
Guelphdad's Avatar
Guelphdad Guelphdad is offline
Hockey face
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: St. Catharines, Canada
Posts: 8,141 Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 20 h 34 m 13 sec
Reputation Power: 1315
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';

Last edited by Guelphdad : October 14th, 2012 at 02:22 PM.

Reply With Quote
  #3  
Old October 14th, 2012, 02:24 PM
rseigel rseigel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 6 rseigel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 48 sec
Reputation Power: 0
Holy crap. You just saved me a lot of agony.

IT WORKS!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > MySQL UPDATE issues

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap