Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MySQL copying a columns data

Posted on 2013-01-06
8
Medium Priority
?
417 Views
Last Modified: 2013-01-12
Hello Experts
I am using Mysql
I have a column A which contains about 2000 image names eg "myimage.jpg"
I have a Column B
I want to copy the images/ plus imagename  into colum B
So the finished entry in Column B wil read images/myimage.jpg
Can anyone please suggest a method to carry this out?

Many thanks

John
0
Comment
Question by:johnhardy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1000 total points
ID: 38749116
Sure, run a query to SELECT the image name column A from the table.  With each row, UPDATE the image name column B with the literal string 'images/' plus thedata from the row of the SELECT query.  It should finish in about one or two seconds!
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 1000 total points
ID: 38749436
If I understand you correctly (you do mean the table has 2000 rows with an image name assigned to column_a for each row right?) you can do this in one UPDATE statement:

update table_name set column_b = concat('images/', column_a);
0
 

Author Comment

by:johnhardy
ID: 38749996
Thanks

I will come back a bit later.

Regards
John
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:johnhardy
ID: 38750054
Had a quick look before being off!

I imagine I perhaps need to use something like MySQL Workbench for this. I have not used the workbench before

Would it be possible to give me some directions how to achive this please. I am familiar with creating a query and a view but wanted to update the table if this is possible.

Thanks
John
0
 
LVL 24

Expert Comment

by:johanntagle
ID: 38750152
I already gave you the statement you need to run to update the table above.  You can find the official documentation on MySQL workbench at http://dev.mysql.com/doc/workbench/en/.  There's a getting started tutorial chapter there.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38750559
Maybe we need to understand this, I have a column A which contains about 2000 image names...

Do you have one row with 2000 image names in a column or do you have 2000 rows with one image name in a column?
0
 

Assisted Solution

by:johnhardy
johnhardy earned 0 total points
ID: 38750944
Sorry for not making myself clear Ray its 2000 imagenames eg  written as "myimage.jpg"

I always find mysql documentation daunting!
Thanks
John
0
 

Author Closing Comment

by:johnhardy
ID: 38769725
Very many thanks for the help again

John
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question