Hello!
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.
Example:
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.
" I need a new Field_ID where the StringValue is the same as the Record_ID value from another row."
Would be something like this:
Select * from tablename where StringValue in (select Record_ID from tablename)
That would give you a list of rows where the string value is the same as a record_ID from any row.
You could then loop through them and update data to your liking.
is that what you needed?