Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query to perfrom "If Then" in phpmyadmin

Author  Topic 

ginjack
Starting Member

1 Post

Posted - 2009-11-19 : 15:13:52
Hello,

My phpmyadmin table is mismatched after i last edited it.
Is there a query i can use in this format =

IN table My_Products
If the "product ID"="300" then make the "product_Type"="Green" and "product_price"="4.00"
If the "STD Code"="5925" then make the "product_type"="Blue" and "product_price"="2.50"

Pls help. I have about 1000 list, and doing it manually is not going to help. I can create a bulk sql if you help me with just one as to how the code will be.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-19 : 15:20:22
if your database is SQL Server, this will work.


Update My_Products
SET product_Type = 'Green',
product_price = 4
WHERE [product id] = 300;

Update My_Products
SET product_Type = 'Blue',
product_price = 2.5
WHERE [STD Code] = 5925;
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-11-19 : 17:22:25
phpmyadmin is for mysql db, if so try here www.sitepoint.com/forums
Go to Top of Page
   

- Advertisement -