detox1978
asked on
MySQL query help
Hi All,
I have two table
Table 1: movies
Fields: id, data1
Table 2: movie_likes
Fields: id, data2
I want to prepend data1 to data2 where the ID's match. The ID in both table only appear once in each table.
Many thanks
D
I have two table
Table 1: movies
Fields: id, data1
Table 2: movie_likes
Fields: id, data2
I want to prepend data1 to data2 where the ID's match. The ID in both table only appear once in each table.
Many thanks
D
ASKER
Sorry I must not have been clear enough.
I want to insert the content of data1 into data2, as "data1 + data2"
I want to insert the content of data1 into data2, as "data1 + data2"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use Cross Table Update...
Cross Table Update with MySQL
Cross Table Update with MySQL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it using a combination of your two posts.
UPDATE movie_likes ml, movies m
SET ml.data2 = CONCAT(m.data1,ml.data2)
WHERE ml.id = m.id
UPDATE movie_likes ml, movies m
SET ml.data2 = CONCAT(m.data1,ml.data2)
WHERE ml.id = m.id
Thanks, sorry missed to point about updating (too much haste), cheers, Paul
*
from table1
inner join table2 on table1.id = table2.id
not much else to go on.