Link to home
Start Free TrialLog in
Avatar of detox1978
detox1978Flag for United Kingdom of Great Britain and Northern Ireland

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
Avatar of PortletPaul
PortletPaul
Flag of Australia image

select
*
from table1
inner join table2 on table1.id = table2.id

not much else to go on.
Avatar of detox1978

ASKER

Sorry I must not have been clear enough.

I want to insert the content of data1 into data2, as "data1 + data2"
SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use Cross Table Update...
Cross Table Update with MySQL
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Thanks, sorry missed to point about updating (too much haste), cheers, Paul