SQL Update query to populate cells with extra data

Hi

i currently have a mysql database with misc information within. and i am trying to populate the image column with the productcodes column data with an extra field being .jpg

table1:
product / productcode / image:
999 / 241441      /            
1016 / 233009 /      

so the above becomes the same as below

product:      productcode:      image:
999            241441            241441.jpg                  
1016            233009            233009.jpg

is there an easy update sql query that can be ran to complete the task? or do i need to go back to the drawing board.

thank you for the help in advance
TG-SteveAsked:
Who is Participating?
 
jimyXCommented:
Let's try CONCAT function:
update table1 set image = CONCAT(productcode,'.jpg')
0
 
jimyXCommented:
You may use this statement:
update table1 set image = productcode+'.jpg'
0
 
TG-SteveAuthor Commented:
query seems to run fine but it is not adding the .jpg

if i go into the phpadmin and click edit i can manually type the productcode plus.jpg and it updates fine
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
TG-SteveAuthor Commented:
well done jimyx worked great. i know this is being concluded now but i just realised that there is a column next to image named "noimages" which needs flagging with 1 instead of 0 if images have been uploaded. can this be inserted into the same query or does it need running seperatly? i understand if you cannot answer and will open another thread.

kind regards
steve
0
 
jimyXCommented:
It can be in the same query:
update table1 set image = CONCAT(productcode,'.jpg'), noimages = '1'

Cheers.
0
 
TG-SteveAuthor Commented:
Thanks again jimyx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.