Mysql
 sql >> Database >  >> RDS >> Mysql

AGGIORNAMENTO MYSQL con IN e Subquery

Usa:

UPDATE entry 
   SET total_comments = (SELECT COUNT(*)
                           FROM COMMENTS c
                          WHERE c.eid = id
                       GROUP BY c.eid)
 WHERE id IN ( SELECT eid 
                 FROM comments 
                WHERE id IN (1,2,3,4,5,6))