Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

Filter by grouped totals

Hi Experts,

I have a MySQL table similar to:
id
agent
location
commission
date
qty
comment

Sometimes agents take a deposit to go towards their commission, and they take may also more then they are entitled to for a particular sale, so the commission field can contain a positive or negative value.

I need to do a report  GROUPed BY location AND agent, but only include those groups (and list all sales details: date, qty, comment,) where the total commission for that group is > 0.  How can I do that?  Would I need a sub-query here?

Any help would be greatly appreciated.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial