Hello! I'm trying to migrate a database table from a joomla installation to drupal. The problem is with the column containing image file names. The column in the joomla table only contains the filename and drupal needs the sourcepath to the image as well.

So I'm wondering if there's a way to update the joomla table and insert the sourcepath before the filename. In other words, keep the current value and insert a new value before the current value.

There's another thread with a similar problem, but I couldn't find the answer to my problem there.
http://www.daniweb.com/forums/showthread.php?t=94707&highlight=update+mysql+before+current+value&page=2

Hello,

What you need to use is CONCAT to merge the information as you put it into the field. Something like:

INSERT INTO newtable ( ID, newfield, otherfield )
select  ID, 
CONCAT('Location_or_Path' , oldtable.oldfield ),
otherfield 
FROM oldtable

That's right. This is the query I ran: UPDATE jos_joomgallery SET imgfilename=concat(path,imgfilename);

path is a new column that I updated with the sourcepath on all rows.

So did it work OK? Looks like it should have.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.