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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -