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

The Archive Base Latest Questions

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

Not sure how to ask this, but let me give you my problem: I

  • 0

Not sure how to ask this, but let me give you my problem:

I have a table with 50 000 records, in one column (named recorded_at) a timestamp. Now what I would like to have a SQL SELECT query (processed with PHP) that results in an array with the total per days. So the result would look like:

$array["2012-01-01"] = 4;
$array["2012-01-02"] = 14;
$array["2012-01-03"] = 45;
$array["2012-01-04"] = 33;

And so on…

I could of course loop through 365 days a year and SELECT 365 times, but that seems very inefficient. Any idea how to do this?

  • 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-14T18:03:20+00:00Added an answer on June 14, 2026 at 6:03 pm

    Try this:

    SELECT DATE(FROM_UNIXTIME(recorded_at)), COUNT(*) totalCOunt
    FROM tableName
    GROUP BY DATE(FROM_UNIXTIME(recorded_at))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure how to ask this, but i'll give it a try: I have
Im not even sure how to ask this question, but i'll give it a
I'm not so sure how ask this, but here's. I bought a domain let's
Sorry but I am not sure how to ask this question but I am
I'm not really sure how to ask this question, but I'll do my best.
I'm not sure I know how to ask this. say I have a function
I'm not sure if this is the right place to ask, but here goes...
Not sure where else to ask this, so I figured I'd give good old
Not sure if this is the right spot to ask but I'm having a
Not even sure if this is feasible, but here's the use case: I 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.