MySQL


From: Bill Downall [mailto:[email protected]]
Sent: Friday, July 29, 2011 8:34 AM
To: [email protected]
Subject: Re: Witango-Talk: Update Prices



Steve,



What's your DBMS? In SQL Server, it could be:





UPDATE Products

SET P_Price1 = p2.PCPrice

FROM Products, PriceUpdate p2

WHERE ((Products.P_Part_Number = p2.PCCode) AND (p2.PCCode IS NOT NULL));



Bill



On Fri, Jul 29, 2011 at 9:29 AM, Fogelson, Steve <[email protected]> 
wrote:

Good Morning,



I am trying to use SQL to update a Product table with current prices. I thought 
the following would work to do that. For test purposes, I have only one product 
code (PCCode) in the PriceUpdate table. What happened when I ran the code was 
that all the Prices (P_Price1) were set to NULL. I guess this makes sense in 
that if a matching row in PriceUpdate is not found it would set it to NULL.



UPDATE Products p1

SET p1.P_Price1 = (SELECT p2.PCPrice FROM PriceUpdate p2

WHERE ((p1.P_Part_Number = p2.PCCode) AND (p2.PCCode IS NOT NULL)));



Is there a way to change this SQL to accomplish what I want to do

1)      Or am I going to have to read the PriceUpdate table and use a loop in 
Witango to update the Product table

2)      Or maybe a stored procedure to accomplish this

Thanks in advance



Steve Fogelson

Internet Commerce Solutions



________________________________

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe witango-talk" in the body.





________________________________

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe witango-talk" in the body.


----------------------------------------

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe witango-talk" in the body.

Reply via email to