Answer the question
In order to leave comments, you need to log in
How to replace values of joined sql tables?
Good afternoon!
There is a SQL database.
I am trying to solve the following issue: it is
necessary to insert the values of the url_flv cell into the direct cell when the value of the uniq_id field in the pm_videos and pm_videos_urls tables matches.
The code:
SELECT pm_videos.url_flv, pm_videos_urls.direct
FROM pm_videos LEFT OUTER JOIN pm_videos_urls ON pm_videos.uniq_id=pm_videos_urls.uniq_id
Answer the question
In order to leave comments, you need to log in
Didn't check:
update pm_videos_urls t1
inner join pm_videos t2
on t2.uniq_id = t1.uniq_id
set t1.direct = t2.url_flv
UPDATE pm_videos SET url_flv = 'bla-bla-bla' WHERE uniq_id IN (SELECT uniq_id FROM pm_videos_urls)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question