TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Apurva Singh
NA
268
56.9k
sum subtract in sql server
Jul 11 2018 7:46 AM
I have a a select commamd
select sd.section_id,Bm.Art,Color,sec.fld_barcode,sec.fld_sectionname,pro_barcode,sd.size,sum(sd.pro_Inqty)-Sum(sd.pro_outqty)as StockInhand from stock_trans_master sm
join stock_trans_details sd
on sm.st_id=sd.st_id
join BarcodeMaster Bm
on Bm.Barcode_m=sd.pro_barcode
join tbl_sectionmaster sec
on sd.section_id=sec.fld_id
where voucherdate <= '11-07-2018 00:00:00'
and (pro_barcode like ''+'%' )
AND (Color like 'S.GREEN' )
AND
(Bm.size like '4' )
AND
(Art like 'AUTUMN' )
and
group by sd.section_id,Bm.Art,sd.size,sec.fld_barcode,sec.fld_sectionname,pro_barcode,Color
This statement return now all data which stockinhand in equal to 0 value
now i want (sd.pro_Inqty)-Sum(sd.pro_outqty)as StockInhand is always return greater than 0 value.
Please suggest me.
thanx
Reply
Answers (
4
)
Data dumping from one to another server
How to Restore SQL Servere 2017 BackUp File SQL Server 2012