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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:07:18+00:00 2026-06-14T16:07:18+00:00

$SQLString = SELECT count(score) as counts, DATE(date), SUM(CASE WHEN gender = 1 then 1

  • 0
$SQLString = "SELECT    
            count(score) as counts,
            DATE(date),
            SUM(CASE WHEN gender = 1 then 1 ELSE 0 END) Male,
            SUM(CASE WHEN gender = 2 then 1 ELSE 0 END) Female,
            AVG(age) as age, score
            FROM persons  
            WHERE date > '".$_SESSION['date1']."' AND date < '".$_SESSION['date2']."' 
            GROUP BY DATE(date) 
            ORDER BY DATE(date) asc";   

This is my Query that display some data, like gender,age, etc per day.
How could I aggregate those dates by months or years and display the added data?

Notice me if Im not explain my self as well 🙂

  • 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-14T16:07:19+00:00Added an answer on June 14, 2026 at 4:07 pm

    GROUP BY year(date), month(date).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$SQLString = SELECT count(score) as counts, score, month, date FROM persons GROUP BY day,
I'm trying to select distinct substring values of a field and count the number
protected static Boolean Authentication(string username, string password) { string sqlstring; sqlstring = Select Username,
So I have the following SELECT statements: SELECT COUNT(A.Award) AS US, SUBSTRING(CAST(M.Year as char(4)),
Both the following two statements produce an error in Postgres: SELECT substring(start_time,1,8) AS date,
I'm attempting to select substrings--the character count, in square brackets--within several paragraphs and wrap
I was using this method to get row-counts for SELECT statements, but it didn't
I'm trying to display the result of an MYSQL select count as a hyperlink
I have an error in my query. Here is the query: select HourTime, count(*)
select substring(datapath,1,5), COUNT(substring(datapath,1,5)) from batchinfo where datapath like '%thc%' group by datapath having COUNT(substring(datapath,1,5))>1

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.