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
 General SQL Server Forums
 New to SQL Server Programming
 Data Summation/Subtraction from 2 different tables

Author  Topic 

wleonard
Starting Member

30 Posts

Posted - 2012-08-14 : 17:27:29
Good day everyone. I'd like some help with my query development.

I need to develop a query which takes the INT values of one column in a table and subtracts them from the INT values of another column in a different table.

The main obstacle is that the values are dependent on a JOIN statement. They're quantities of specific item numbers that are extracted from the JOIN statement. If anybody has any suggestions, it would be appreciated.

Cheers.

Will Leonard

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-14 : 18:02:18
[code]
select *,t1.col1-t2.col2 as diff
from table1 t1
join table2 t2
on t2.relatedcol = t1.relatedcol
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -