Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query help
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Query help
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01398766
Message ID:
01398766
Views:
102
Hi All,

Is there a way without using a cursor to have only one Calc column instead of 3 (Calc1, Calc2 & Calc3) based on the condition below?
select a.EDPNo, b.PVC, a.EachWeight,
		c.VendNo, c.TermsPct, c.FrtCharge, c.FreeFrt, c.FrtAsPct, c.FrtChargePct,
		--c.FreeFrt = 1
		(b.PVC - (b.PVC * (c.TermsPct / 100))) as Calc1, 
		--c.FrtAsPct = 1
		(b.PVC + (b.PVC * (c.FrtChargePct / 100))) - (b.PVC * (c.TermsPct / 100)) as Calc2, 
		--c.FreeFrt = 0 & c.FrtAsPct = 0
		(b.PVC + (c.FrtCharge * a.EachWeight)) - (b.PVC * (c.TermsPct / 100))  as Calc3
from DS1.dbo.ItemMst a join DS1.dbo.PItems b on a.EDPNo = b.EDPNo
	 inner join DS1.dbo.VendorMst c on a.VendNo = c.VendNo
Thanks,
Daniel
Next
Reply
Map
View

Click here to load this message in the networking platform