I need to find users that received bonus at my DB. The only users that interest to me, are those who got bonus more than one time.
How should I work this query to get ONLY users who got bonus more than once?
select Bonus, BonusUser, BonusType, Amount
from Bonus
where BonusType="1"
order by BonusUser asc;
I need a query that prompts all “duplicated” rows, so I can remove bonus from them.
I haven’t explained before, but some users exploited a bug and could get free bonus, so I must select those duplicated rows, analyze and remove if it’s abuse case.
Add a
GROUP BYand aHAVINGclauseBased on your comment, I think this is what you want, this will give you the list of all users with a bonus but it will give you the count of those who had more than one bonus: