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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:58:54+00:00 2026-06-06T17:58:54+00:00

I have a database in which there is a user table & how many

  • 0

I have a database in which there is a user table & how many time they reward record table I wanna result like this (WEEK WISE)

user_name user_week user_reward
abc          24,25,26    4,5,6

My query is like this

SELECT WEEK(cpd.added_date),COUNT(cpd.result)
FROM cron_players_data cpd WHERE cpd.player_id = 81
AND cpd.result = 2 AND cpd.status = 1
GROUP BY WEEK(cpd.added_date);

And Result is

user_name user_week user_reward
abc          24    4
abc          24    5
abc          24    6

i use group_concat with count but its useless is there any alternate method for this desire result

  • 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-06T17:58:55+00:00Added an answer on June 6, 2026 at 5:58 pm

    You have 2 level grouping, first week, and then username,
    so i sugest you use a subquery for that first grouping like:

    SELECT
     user_name,
     GROUP_CONCAT(user_week) AS user_weeks, 
     GROUP_CONCAT(user_reward) AS user_rewards
    FROM (
      SELECT
       user_name,
       WEEK(cpd.added_date) AS user_week,
       COUNT(cpd.result) AS user_reward
      FROM cron_players_data AS cpd 
      WHERE
       cpd.player_id = 81 AND
       cpd.result = 2 AND
       cpd.status = 1
      GROUP BY user_week
    ) as temp
    GROUP BY user_name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to work on a database in which there are many stored-procedures &
I have a database table named 'student' in which there is one column named
I have a database in MySQL which have entries of time. There are more
I have a database in MYSQL and it has chat table which looks like
I have a mysql database in which there is about hundreds of category for
I have a SQL Server database which I can read from, is there a
I have an existing database with tables which each have 4 partitions (there are
I have a page which displays my database information. Through each loop, there is
There are 5 websites in ASP.NET 2.0 which have the same code and database
I would like to create user in my user table when new user have

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.