Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Adding the results of two select statements

Author  Topic 

sahu74
Posting Yak Master

100 Posts

Posted - 2002-07-03 : 16:37:31
I have numeric results from two different queries and would like to add them. Could anyone suggest how to go about it?

Thank you.
PKS

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-07-03 : 18:47:27
Select them into two variables, and then add teh variables together into a single variable.

Post the two Statements you are running, and we can give you a more exact answer.

Michael

<Yoda>Use the Search page you must. Find answer you will.
Go to Top of Page

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-07-08 : 08:12:11
SELECT a.total + b.total
FROM Query1 a,
Query2 b

Can it be that simple? Let me know if this is not what you mean.

Jeremy

Go to Top of Page

sahu74
Posting Yak Master

100 Posts

Posted - 2002-07-15 : 10:24:37
Thanks Jeremy. Works perfect.

bye
PKS

quote:

SELECT a.total + b.total
FROM Query1 a,
Query2 b

Can it be that simple? Let me know if this is not what you mean.

Jeremy





Go to Top of Page
   

- Advertisement -