Please start any new threads on our new
site at http://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Our new SQL Server Forums are live!
Come on over! We've restricted the ability to create new threads on these forums.
TxId Item Name FromLocationId ToLocationId Qty
1 9001 Pen 10 11 100
TxId Item Name FromLocation Qty
1 9001 Pen 10 -100
1 9001 Pen 11 +100
Flowing Fount of Yak Knowledge
FromLocationId as FromLocation,
-Qty as Qty
ToLocationId as FromLocation,
Qty as Qty
Very Important crosS Applying yaK Herder
CASE WHEN mult=-1 THEN FromLocationId ELSE ToLocationId END as FromLocation,
Qty * mult as Qty
cross join (select -1 as mult union all select 1)m