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
 Need Query

Author  Topic 

dgsd_in
Starting Member

1 Post

Posted - 2008-01-24 : 01:44:24
Hi

I am new to sql forums. I am just confused to create a query.
I have a sales table that contains sum of sold items and also another column that contains no. of cancelled items after sale. Now i have to get the sum of all those items which are soled after deducting the cancelled items amount. Can somebody help me in this regard.

Thanks & Regards
Ravi

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-24 : 01:53:37
Try this
declare @table table
( sold int,
cancel int
)
insert into @Table
select 25,5 union all
select 35,3

select sold-cancel [Total Sale] from @Table

Also, post proper DDL and required result in future to get best help.

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -