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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:53:57+00:00 2026-05-14T03:53:57+00:00

I need to be able to display data that I have in 15 minute

  • 0

I need to be able to display data that I have in 15 minute increments in different display types. I have two queries that are giving me trouble. One shows data by half an hour, the other shows data by hour. The only issue is that the data totals change between queries. It’s not counting the data that happens between the time frames, only AT the time frames.

Ex:
There are 5 things that happen at 7:15am. 2 that happen at 7:30am and 4 that show at 7:00am.

The 15 minute view displays all of the data.
The half hour view displays the data from 7:00am and from 7:30am but ignores the 7:15am.
The hour display only shows the 7:00am data

Here are my queries:

$query="SELECT * FROM data WHERE startDate='$startDate' and queue='$queue' GROUP BY HOUR(start),floor(minute(start)/30)";

and

$query="SELECT * FROM data WHERE startDate='$startDate' and queue='$queue' GROUP BY HOUR(start) ";

How can I pull out the data in groups like I have but get all the data included?

Is the issue the way the data is stored in the mysql table? Currently I have a column with dates (2010-03-29) and a column with times (00:00) Do I need to convert these into something else?

  • 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-05-14T03:53:57+00:00Added an answer on May 14, 2026 at 3:53 am

    You’re interpreting the ‘group by’ wrong. You don’t “group” multiple records so you can get them all with a single fetchrow() call. What happens is the database will collapse all records matching the group-by clauses into a single record. Take a simple game score table:

    id   playername  score
    ----------------------
    1    John        23
    2    Fred        12
    3    Jack        9
    4    John        18
    

    If you did the following query: SELECT id, playername, score FROM table GROUP BY playername, you’d get the following result set:

    id   playername  score
    ----------------------
    1    John        23
    2    Fred        12
    3    Jack        9
    

    Hey! Where did John #4 go? He’s vanished, because the row with id#4 matched the GROUP BY clause and has been collapsed into the first row that was found to match (#1). Not very useful by itself, you’ve now lost all the data associated with id #4. But this is where the aggregate functions (sum, count, average, etc…) come into play: SELECT id, playername, SUM(score) FROM table GROUP BY playername:

    id   playername  score
    ----------------------
    1    John        41   <---notice the change (23 + 18 = 41)
    2    Fred        12
    3    Jack        9
    

    With your queries, you’ve got two choices:

    1. Leave the GROUP BY as-is, and do whatever calculations you want on the grouped data within the query (summing, counting, averaging, etc…) so that you get aggregate results for each of the matching time periods
    2. Remove the GROUP BY clauses, perform whatever calculations you want in your application
    3. Convert the GROUP BY clauses into result fields in the query, so you can process per-period in your code based on these new columns: SELECT *, HOUR(start), FLOOR(MINUTE(start)/30) FROM data
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to take a string like: '''foo, bar, one, two,
I need to be able to merge two (very simple) JavaScript objects at runtime.
I have to write a simple mobile application that is able to receive broadcast
I have an application that displays the data from 3 xml files (auto generated
I got a backend web service containing massive amounts of data that I have
I have some data with one row of headers and one or more rows
It seems that a lot of small business people have a need for some
I have a list view that can display items based on internal state (it
I need to be able to create basic MS Project items (tasks, projects, resources,
I need to be able to get at the full URL of the page

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.