Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7821079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:31:55+00:00 2026-06-02T07:31:55+00:00

I need to find users that received bonus at my DB. The only users

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:31:56+00:00Added an answer on June 2, 2026 at 7:31 am

    Add a GROUP BY and a HAVING clause

    SELECT Bonus
        , BonusUser
        , BonusType
        , Ammount 
    FROM Bonus 
    WHERE BonusType="1" 
    GROUP BY BonusUser
    HAVING Count(*) > 1
    ORDER BY BonusUser asc;
    

    Based 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:

    SELECT Bonus
        , t.BonusUser
        , BonusType
        , amount 
        , t2.cntbonus
    FROM Bonus t
    inner join 
    (
        select count(*) as CntBonus, bonususer
        from Bonus
        where BonusType='1'
        group by bonususer
    ) t2
        on t.bonususer = t2.bonususer
    WHERE BonusType='1'
    ORDER BY BonusUser asc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find the cluster size of the users hard drive, through C
I have a many_to_many relationship between ImageShells and Users. I need to find all
Given a user input string, I need to find if it end with one
I need to find a service that will allow me to send and receive
I have a table of emails. And i need that Each user received email.
I am building a custom admin extension, I need to find a user's role
I need to find out the word in an image where user has clicked.
Need to find the timestamp for the first minute of the first day of
I need to find a flexible solution for access control in PHP. In the
i need to find out automationid for key board values? how to send keystrokes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.