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

  • Home
  • SEARCH
  • 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 8433971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:31:54+00:00 2026-06-10T06:31:54+00:00

Could anybody please help me on SQL command? I have a table (tbl_sActivity) that

  • 0

Could anybody please help me on SQL command?

I have a table (tbl_sActivity) that have below data:

user_id | client_id | act_status |
1           |     7        |
     cold     |
1           |     7        |
   dealed   |
22         |     5        |
     cold     |
1           |     6        |
     cold     |
1           |     6        |
    warm    |
1           |     6        |
     hot       |
1           |     6        |
   dealed   |
1           |     8        |
    warm    |
1           |     8        |
   dealed   |
21         |     4        |
    warm    |
21         |     4        |
   dealed   |

The out put should be

user_id | Count_C_id |
 1          |
    3             |
 21        |
    1             |
 22        |
    1             |

I’ve searched from net and learnt that MS ACCESS cannot use COUNT(DISTINCT) function. So I’m stuck at this stage for days.

  • 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-10T06:31:56+00:00Added an answer on June 10, 2026 at 6:31 am

    Try this one. The “trick” is to have a subquery first to get all the distinct combinations of user and client IDs and then do the grouping per user:

    SELECT
        user_id
      , COUNT(*) AS count_distinct_clients
    FROM
        ( SELECT DISTINCT
              user_id, 
              client_id
          FROM tbl_sActivity
        ) AS tmp
    GROUP BY
        user_id ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could anybody please help me to write rewriterule, that redirects http<->https (back and force
please help me with writing this search sql stored procedure procedure may have different
could please anybody help me to install spring surf ? According to this video
I wonder if anybody could help me please with a tricky problem I am
Could please anybody help me to sort it out? It can be done like
I am getting below exception in runtime, could anybody suggest what is wrong? Microsoft
I was wondering if anybody could help me with a method of creating a
I am new to php and was wondering if anybody could help me with
Does anybody know where I could find WinForms controls that mimic those on the
I am facing SIGEV with this malloc wrapper code, can anybody please help me?

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.