Is it possible to make a column on my database that automatically copy another column on the same table string together with another url?

for example on my database "ewelby_k5" I want to create a new column called (fullthumb) on table "files" where "fullthumb" stores "http://k5live.com/thumbs/ + column "thumb" "

so that I will get http://k5live.com/thumbs/image.jpg on "fullthumb" column

Recommended Answers

All 4 Replies

Create a column in the table with ALTER TABLE command. Then execute the following query

UPDATE files SET 
fullthumb = CONCAT('http://k5live.com/thumbs/', thumb);

Create a column in the table with ALTER TABLE command. Then execute the following query

UPDATE files SET 
fullthumb = CONCAT('http://k5live.com/thumbs/', thumb);

will this code be ran all the time to always update

Or you can create a trigger to UPDATE this for you when a new record is inserted.

Or you can create a trigger to UPDATE this for you when a new record is inserted.

nice...so how would i create a trigger to by default store "'http://k5live.com/thumbs/" and add thumb to it.

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.