dbTalk Databases Forums  

How to calculate the midpoint

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss How to calculate the midpoint in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
amj1020
 
Posts: n/a

Default How to calculate the midpoint - 11-07-2007 , 08:48 AM






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.11


Reply With Quote
  #2  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: How to calculate the midpoint - 11-07-2007 , 04:27 PM






On Wed, 07 Nov 2007 06:48:09 -0800, amj1020 wrote:

Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.