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.
Vack Aged Yak Warrior
530 Posts
SELECT *, old_quantity + quantity AS NewQTyFROM dbo.[old qty] sWHERE (trx_tm = (SELECT MAX(trx_tm) FROM [old qty] WHERE item_no = S.item_no))GROUP BY item_no, old_quantity, trx_dt, trx_tm, loc, doc_type, quantity
webfred Master Smack Fu Yak Hacker
8781 Posts
CASE doc_type WHEN 'I' THEN old_quantity - quantity ELSE old_quantity + quantity END as NewQty
SQLTeam.com Articles via RSS
SQLTeam.com Weblog via RSS
- Advertisement -
Articles
Forums
Blogs
Contact Us
About the Site