Linked Questions
52 questions linked to/from Function to Calculate Median in SQL Server
1
vote
3
answers
16k
views
SQL Server: how to calculate median (group by)? [duplicate]
Possible Duplicate:
Function to Calculate Median in Sql Server
I have a table like this:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[cars](
[...
1
vote
1
answer
22k
views
Median instead avg() in SQL Server 2012 [duplicate]
I have this query
;WITH cte AS
(
SELECT
*,
DATEPART(WEEKDAY, Dt) AS WeekDay,
PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY SaleCount) OVER (PARTITION BY CustomerType, [...
0
votes
3
answers
2k
views
SQL function to calculate median [duplicate]
Possible Duplicate:
Function to Calculate Median in Sql Server
I have a table containing two field (more, but not relevant). The fields are Price and Quantity. I want to find several ...
0
votes
1
answer
320
views
Mean vs Median that is the? [duplicate]
I have a number of select statements which calculate fields such as sums, division and also averages. However I am now needing to include a median based on the query, as well as a mean(avg). The table ...
0
votes
1
answer
289
views
How to find the median number in SQL query? [duplicate]
Query
SELECT SpaID, COUNT(1) AS Total FROM dbo.[Order] (nolock)
WHERE DateCreated BETWEEN '04-01-2014' AND '04-30-2014'
GROUP BY SpaID
I need to find the median amount in the new column named "...
0
votes
0
answers
209
views
Find Median of DateDiff Result [duplicate]
I have this as my Average Statement and am wanting to get the Median Value:
select AVG (DATEDIFF("m", dlg_applicationreceived, dlg_dateofdecision)) as TimetakenAVG,
format(dlg_dateofdecision, 'MMM-yy'...
0
votes
2
answers
158
views
How to obtain the median of a table column using T-SQL query? [duplicate]
Kindly help with the following T-SQL query. The data used is that of us_counties_2010.
SELECT
SUM(P0010001) AS 'County Sum',
ROUND(AVG(P0010001),0) AS 'County Average',
PERCENTILE_CONT(0....
0
votes
1
answer
113
views
Display the Value of the Median from a Dynamical table [duplicate]
Possible Duplicate:
Function to Calculate Median in Sql Server
Goal:
Display the value of the median based on this code below.
Problem:
I don't how to do display it in SQL server
The table can ...
0
votes
0
answers
113
views
Calculate Mode and Median for data in SQL [duplicate]
Hi I have a table facility that holds a score for each day (Multiple scores can be reported each day and both would be valid)
I need to calculate the Mode and Median score by month.
Facility:
Id ...
-1
votes
1
answer
70
views
How to pick up median value in between 3 records? - SQL [duplicate]
Please assist me, I need to pick 790 since its in middle but not able to figure it out.
id Value
12 780
123 796
124 790
Thank you in advance
0
votes
0
answers
33
views
Calculate Median in SQL for the particular data set [duplicate]
I have a Data Set as below and need to calculate median for that set.
Below Data Set is a growing Data set. Just display only the first 2 Ids.
Need to display it as group by with ID,Month and Section
...
0
votes
0
answers
21
views
Calculate the median to 4 decimal places [duplicate]
Given a table, station, with one of its column, LAT_N. What is the median of LAT_N to 4 decimal places?
with newstation as (select lat_n from station order by lat_n asc)
select count(lat_n) as n
case ...
271
votes
50
answers
405k
views
Simple way to calculate median with MySQL
What's the simplest (and hopefully not too slow) way to calculate the median with MySQL? I've used AVG(x) for finding the mean, but I'm having a hard time finding a simple way of calculating the ...
6
votes
5
answers
16k
views
Median values in T-SQL
For even rows, the formula for median is (104.5 + 108)/2 for the table below and for odd rows it is 108 for table below:
Total Total
100 100
101 101
104.5 104.5
108 ...
12
votes
3
answers
25k
views
How to find the SQL medians for a grouping
I am working with SQL Server 2008
If I have a Table as such:
Code Value
-----------------------
4 240
4 299
4 210
2 NULL
2 3
6 30
6 80
6 10
4 240
2 ...