I got one table called family
, which contains a column called power
. I want to update maximum ten values of power by adding one in each row and the rest remains the same. I try my own method by creating another table which contains the maximum ten values that I want to update and create a query below, but got some problems. Here's the query:
UPDATE family
SET family.total = (SELECT totalmax.total FROM totalmax
INNER JOIN familyone
ON family.family_id2 = totalmax.family_id2
WHERE family.family_id2 = totalmax.family_id2)
Can someone tell me where's the problem with this query and is there any other methods to solve my problem?
You could do this with a join
UPDATE family
INNER JOIN
totalmax
ON family.family_id2 = totalmax.family_id2
SET family.total = totalmax.total
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.