caucus1 — 2012-06-08T06:02:54-04:00 — #1
Hello Great Forum
I have an e- commerce database (x-cart) that has all the productcodes starting with SKU??????
I would like to change all the items that begin with SKU and replace that with a WH
The digits after the SKU will stay there and all I will be replacing is the SKU with WH
In cpanel with PHPadmin I can do one at a time of course but that does not seem like a great idea when we have SQL. I think I have 600 items in the column that I want to change from SKU to WH.
I know I have to do an update for that column but I cannot figure it out,
What would be really nice is to replace the SKU with WH1001 and increment each item by 1 so the next item I replace would be WH1002, WH1003.
Anyway replacing the SKU with the WH is the key.
r937 — 2012-06-08T07:18:39-04:00 — #2
SET productcode = REPLACE(productcode,'SKU','WH')
WHERE productcode LIKE 'SKU%'
caucus1 — 2012-06-08T07:50:33-04:00 — #3
Thank you I would have never figured this out. I purchased the sitepoint book SIMPLY SQL and I could not wrap my brain on how to do this. I am going to give it a try as soon as I get to my desk.
BTW. I do like the book.
r937 — 2012-06-08T08:07:24-04:00 — #4
thanks, that's good to hear
caucus1 — 2012-06-08T08:30:28-04:00 — #5
Wow, SQL is the greatest thing since "Carter had Liver Pills" Hopefully I can manipulate data the way I want and know what I am doing. Thanks again for the help.