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

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -