Wednesday, March 7, 2012

How to calculate the midpoint

I have three fields date, low, high. I need to calculate the midpoint
of low and high and display it.

Date,Low,High
20071106,92.03,92.13
20071106,88.77,88.87
20071106,90.20,90.30
20071106,95.21,95.31
20071106,93.13,93.23
20071106,91.01,91.11On Wed, 07 Nov 2007 06:48:09 -0800, amj1020 wrote:

Quote:

Originally Posted by

>I have three fields date, low, high. I need to calculate the midpoint
>of low and high and display it.


Hi amj1020,

SELECT "date", (low + high) / 2.0 AS midpoint
FROM YourTable;

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

No comments:

Post a Comment