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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:57:45+00:00 2026-05-24T12:57:45+00:00

I am doing some queries from a database to make graphs, and a graph

  • 0

I am doing some queries from a database to make graphs, and a graph that may be needed is the median of a set of values per month. I know how to get the median of the whole set of our data, but for some reason I can’t get GROUP BY MONTH(..) to separate the months so it returns the median per month.

Here is the data that I have and I’d like for every month to get the median value for each month regardless of build type.

'Development', 1013.0164, 'June'
'Development', 1170.8999, 'July'
'Development', 671.2837, 'August'
'Flash Assets', 2961.3832, 'June'
'Flash Assets', 6662.2335, 'July'
'Flash Assets', 3902.5000, 'August'
'Release', 54.5499, 'June'
'Release', 62.4832, 'July'
'Release', 398.8500, 'August'
'Repackage', 1360.0834, 'June'
'Repackage', 6286.8505, 'July'
'Repackage', 1274.7833, 'August'
'Component', 16378.0161, 'June'
'Component', 6063.5482, 'July'
'Component', 23663.2496, 'August'
'Source Diff', 1503.8834, 'June'
'Source Diff', 1051.4500, 'July'
'Source Diff', 73.7002, 'August'

I’d like to end up with this,

June, XXXX
July, XXXX
August, XXXX

Thanks.

EDIT: Current Query

This is the query that I am using right now to get the overall median, I am not sure how to translate this to getting it per month.

 SELECT t.Data AS 'Median' FROM
 (SELECT CEIL(COUNT(*)/2.0) as 'Middle', s.Data as 'Data' FROM
 (SELECT bt.name as 'Labels', 
 SUM(TIME_TO_SEC(TIMEDIFF(bs.eventtime, b.submittime))/60.0) 
 AS 'Data', MONTHNAME(b.submittime) FROM builds b 
 JOIN buildstatuses bs ON bs.buildid = b.id 
 JOIN buildtypes bt ON bt.id = b.buildtype 
 WHERE MONTH(b.submittime) BETWEEN MONTH(CURDATE())-2 AND MONTH(CURDATE()) 
 AND bs.status LIKE 'Started HANDLER' 
 GROUP BY b.buildtype, MONTH(b.submittime) ORDER BY 'Data' ) s )t;
  • 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-24T12:57:46+00:00Added an answer on May 24, 2026 at 12:57 pm

    if your value is always in float … you can try this —

    assume Data is the value column

    select mth,
    substring_index
    (
      substring_index
      (
        group_concat(Data order by Data), ',', 
        count(*)/2+1
      ), 
      ',', -1
    )
    from your_tables
    group by mth;
    
    • group_concat will sort the values for month in ascending order
    • then use of first substring_index will return from first value to middle value +1 more position
    • then next substring_index will help you to ge tthe right most value (which is the median)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im doing some queries in Zend Framework and i need to make sure no
I'm working with a large database where we've got some key queries that rely
I am working on doing some data transfers moving data from one database to
I have some queries that are taking too long (300ms) now that the DB
i have 2 queries, and i get back some data by doing a whyle
I want to add some rows to a database using Linq to SQL, but
So I'm trying to import some sales data into my MySQL database. The data
Currently, my entire website does updating from SQL parameterized queries. It works, we've had
Ok I've seen this question Entity Framework: Generate Database From Model removes Stored Procedures
We are currently doing an web application which one of the functionality is to

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.