Answer the question
In order to leave comments, you need to log in
How to use SQL UPDATE a field on the result of a SELECT?
The essence of the question, for example, there is such a request
SELECT @sql_avrg_pulse := ((SELECT avrg_pulse FROM c_p WHERE c_id = c.id AND (created_at BETWEEN '2014-12-08 22:00:00' AND '2014-12-09 21:59:59') LIMIT 1) + calc_chall_pulse(c.id,c_p.reply_count,c_p.share_count,
c_p.comment_count,c_p.full_view_count,
c_p.like_count,c_p.view_count))/2,
c.id, c.average_pulse, c.created_at
FROM c, c_p, pulse_modificators
WHERE pulse_modificators.id = 1 AND
(`c_p`.`created_at` BETWEEN '2014-12-09 22:00:00' AND '2014-12-10 21:59:59') AND
`c_p`.`challenge_id` = `c`.`id` LIMIT 10;
Answer the question
In order to leave comments, you need to log in
update table set field = (select value from table where condition) where condition; ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question