There are two tables, A is the detailed table
id uid cost
0
1
4
3
Now we need to group the data with cost greater than 0 in the table according to uid and update it to another table
select uid,count(cost) as count from A group by uid where cost > 0
This is the statement taken out. Is there any way to update the query results to another table based on uid in one sentence?
扔个三星炸死你2017-06-26 10:51:25
update B b set b.col=(select count(a.cost) as count from A a where cost > 0 and a.uid=b.uid group by uid)