How do I add values from two seperate querys in SQL
Posted
by fishhead
on Stack Overflow
See other posts from Stack Overflow
or by fishhead
Published on 2010-04-11T19:23:24Z
Indexed on
2010/04/11
19:33 UTC
Read the original article
Hit count: 315
sql-server
|sql
Below is my attempt at addinf two values from seperate select statments...it's not working...I can't see why. Looking for some direction thanks
select (v1.Value + v2.Value) as total from
(
(Select Max(Value) as [Value] from History WHERE
Datetime>='Apr 11 2010 6:05AM' and Datetime<='Apr 11 2010 6:05PM'
and Tagname ='RWQ272017DTD' ) as v1
(Select Max(Value) as [Value] from History WHERE
Datetime>='Apr 11 2010 6:05AM' and Datetime<='Apr 11 2010 6:05PM'
and Tagname ='RU282001DTD' ) as v2
)
boy do I feel foolish...I asked the same question a few days ago...now I can't delete this.
© Stack Overflow or respective owner