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

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

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -