mysql - Sql group by addition -


i have query pull records of 'consultant' 'marketing_fee'. results below :

enter image description here

is there way group them consultant (the middle column) add of marketing_fee's?

the code i'm using @ moment gets latest fees.

select a.marketing_fee, v.consultant, user.colorcode  valuations v  join status_history sh on sh.ref = v.ref  join user on user.username = v.consultant  join answer on a.title = v.ref  sh.status = 'booked' , sh.date between '2016-09-07 23:59:00' , '2016-09-14 23:59:00' 

is want?

select v.consultant, sum(a.marketing_fee) valuations v join      status_history sh      on sh.ref = v.ref join      user on user.username = v.consultant join      answer on a.title = v.ref  sh.status = 'booked' ,       sh.date between '2016-09-07 23:59:00' , '2016-09-14 23:59:00' group v.consultant; 

Comments

Popular posts from this blog

php - isset function not working properly -

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -