troubleshooting Question

How do I go through a MySQL table in a database and add records using some information stored in existing records in that table?

Avatar of ramsait
ramsait asked on
5 Comments1 Solution257 ViewsLast Modified:

I think I need some expert help here.

So I've been trying to figure out how to do this and I'm stumped, hopefully I make sense here.

We have a table in a MySQL database that has 3 columns. It stores information about images in an image database.

Field_ID, Record_ID, String Value

Field_ID - is the type of field that we use for data retreival purpoes (city state country, image name etc)
Record_ID - is unique number for that image (can be used more than once, but the field_ID must be different)
StringValue - is the name of the city, state, country, image name etc.


10102, 2989455, Spain
10104, 2989455, Madrid
10207, 2989455, madrid.jpg

Now I need a new Field_ID where the StringValue is the same as the Record_ID value from another row. Essentially adding more information about that image.

So search for any of these:

10102, 2989455, Spain
10104, 2989455, Madrid
10207, 2989455, city.jpg

and then making one of these if it doesn't already exist (without duplicates):

10105, 298455, 298455

I'm not sure how to do this, I'm not very good with writing SQL statements, would php be good for this? I don't know where to begin. Any help would be greatly appreciated.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros