mysql - Nested update in select -
i executing
select id uid, ( update trans set paidout=1 user_id=uid , sum(amount)>0.5234 ) accounts
but no success, why doesn't work?
you have used wrong syntax ,you can use select subquery in update query, in select query can't update subquery ,if want update paidout
trans table scenario user_id same id accounts table , sum of user amount should greater 0.5234 can
update trans t join accounts on(t.user_id = a.id) join (select user_id trans group user_id having sum(amount) > 0.5234 ) tt on(tt.user_id = a.id) group a.id set t.paidout=1
Comments
Post a Comment