Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Median Function?

Status
Not open for further replies.

grnzbra

Programmer
Mar 12, 2002
1,273
US
I have the following in a stored procedure:

INSERT INTO
@TempOutTable
(
NoAgts,
MinDesVal,
MaxDesVal,
AvgDesVal
)
SELECT
Count (*),
Min(DesiredVal),
Max(DesiredVal),
Avg(DesiredVal)
FROM
@TempTable

The SQL Server Books on Line says that a Median function should look like this:

Syntax
Median(«Set»[, «Numeric Expression»])

The following example returns 2000 if respective Sales of the countries are 1000, 2000, and 3000:

Median({USA, CANADA, MEXICO}, Sales)

When I try to use the word "Median", I get an error message saying that Median is not a recognized function. What may be causing this (I also tried "Med")?

How would one set this up to use my set of DesiredVal?



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top