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
 Extra row

Author  Topic 

maya_zakry
Constraint Violating Yak Guru

379 Posts

Posted - 2007-01-18 : 21:02:04
hi all,

i wonder if i could break one row to multiple row base on this case :-

status=A OriginQty=10 HoldQty=3

i want to print the status=H for the remaining originqty-holdqty
isit possible to digest this data in my SP to:-

status=A BalQty=7
status=H BalQty=3



~~~Focus on problem, not solution~~~

nr
SQLTeam MVY

12543 Posts

Posted - 2007-01-18 : 21:07:21
select status = 'A', BalQty = OriginQty - HoldQty from tbl
union all
select status = 'H', BalQty = HoldQty from tbl


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-01-19 : 20:18:46
I absolutely love your sig, NR!

--Jeff Moden
Go to Top of Page
   

- Advertisement -