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 7960185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:41:20+00:00 2026-06-04T04:41:20+00:00

I have a table with 4 columns: ID , USER_ID , SOURCE , CREATED_DATE

  • 0

I have a table with 4 columns:

ID, USER_ID, SOURCE, CREATED_DATE

In that table is the following data:

ID  USER_ID SOURCE          CREATED_DATE
1   25      PURCHASE        2012-01-01 12:30:00
2   26      PLEDGE          2012-01-01 12:40:00
3   25      PLEDGE          2012-01-01 12:50:00
4   25      PURCHASE        2012-01-14 12:00:00

Now as you can see, I have 4 rows of data, and two unique users. User (25) made 3 transactions (two purchases and one pledge), user (26) made one transaction – (one pledge)

Here is what I am trying to achieve:

I need to select ALL transactions from this table, but I want to select a UNIQUE user for each REQUEST TYPE (source), and that row needs to be the EARLIEST TRANSACTION.

My expected result data would be:

ID  USER_ID SOURCE          CREATED_DATE
1   25      PURCHASE        2012-01-01 12:30:00
2   26      PLEDGE          2012-01-01 12:40:00
3   25      PLEDGE          2012-01-01 12:00:00

User (25) made TWO PURCHASES (one on 2012-01-01 and one on 2012-01-14) – the first is the one that gets returned.

This is the SQL I have come up with so far:

    SELECT 
        Supporter.user_id,
        MIN(Supporter.created) as created,
        Supporter.*,
        Supporter.source
    FROM
        supporters AS Supporter

    GROUP BY Supporter.source
    ORDER BY Supporter.created ASC

Now, this gets me really close, except it only selects ONE of the user id’s (the one with two items – a pledge and a purchase). If I could figure out how to select the data on both users, that would be what I need to do! Can anyone see what I am possibly doing wrong here, or missing?

  • 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-04T04:41:21+00:00Added an answer on June 4, 2026 at 4:41 am

    You need to group by source and by user id

    Something like this

    SELECT 
        Supporter.user_id,
        MIN(Supporter.created) as created,
        Supporter.*,
        Supporter.source
    FROM
        supporters AS Supporter
    
    GROUP BY Supporter.user_id, Supporter.source
    ORDER BY Supporter.created ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a score table that contains two columns: user_id and score user_id    score 1               200
I have a table with the following columns: user_id, key, value, and flag. The
I have a table called credit_log and the columns are user_id | amount The
I have a table called order which contains columns id , user_id , price
I have 3 tables with the following columns : * users : user_id *
I have a table [Users] with the following columns: INT SmallDateTime Bit Bit [UserId],
I have a table with columns user_id , time_stamp and activity which I use
I have one table with 2 columns that i essentially want to split into
I have the following 3 rows in my database table ID resID userID source
I have a table posts with columns post_id , user_id , post . When

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.