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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:59:32+00:00 2026-06-09T11:59:32+00:00

I have tbl_sActivity that looks like this: act_id | Client_id | act_status | user_id

  • 0

I have tbl_sActivity that looks like this:

act_id | Client_id | act_status | user_id | act_date
1         |      7       |      warm    |     1       | 19/7/12
2         |      7       |      dealed  |     1       | 30/7/12
3         |      8       |      hot        |     1       | 6/8/12
4         |      5       |      cold       |    22      | 7/8/12
5         |      6       |      cold       |     1       | 16/7/12
6         |      6       |      warm     |     1       | 18/7/12
7         |      6       |      dealed   |     1       | 7/8/12

I want to count act_status of each user_id’s clients from their latest status. The output should come out like this

user_id | act_status | Count(act_status)
1           |    dealed    |    2
1           |      hot        |    1
22         |     cold       |     1

but what i can do was only to display their latest activity with no feature. So please kindly help me. Thank you very much.

  • 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-09T11:59:33+00:00Added an answer on June 9, 2026 at 11:59 am

    I didnt get your logic, the simples query would be something like this:

    select user_id, act_status, count(act_Status)
    from your_table
    group by user_id, act_status
    

    but why doesnt it have the “cold” on user 1 on your expected output?

    EDIT:

    select user_id, act_status, count(act_Status)
    from your_table
    where act_date in (
        select  max(act_date)
        from your_table
        group by Client_id
    )
    group by user_id, act_status
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that looks like this: $sql = UPDATE tbl SET amt_field='amt_field+1'
I have a table tbl which looks like this: prod | cust | qty
i have a table (tbl_world) which look like this id | first_name | last_name
I have 2 tables tbl_UserRegistration and tbl_Streaks with structures like this: tbl_UserRegistration DATATYPE LENGTH
I have a mysql query Select * from tbl_schoolphotos where Filename like 'glasshouse_1_%' order
We have a lot of queries select * from tbl_message that get stuck on
I have 3 tables with values like below **tbl_product** recID pID price colour 1
I have a custom Title Bar so I want that when the user types
I have tables like tbl_biodata: id : int value=>1 name : varchar(50) value =>
i have a table 'tbl_orders', that table contains the folllowing order_id | customer_id |

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.