April 13, 2005 at 7:23 pm
Guys,
I know this query works with Sybase, but it does not work with sql server,
select
(quantity * price) as subtotal,
(subtotal * .05) as tax
from
table
Does anybody know any solution to this?
(without changing the second "subtotal" to "quantity * price")
April 13, 2005 at 7:27 pm
select subtotal, (subtotal * .05) as tax
FROM (select (quantity * price) as subtotal
from table) DT
_____________
Code for TallyGenerator
April 13, 2005 at 7:27 pm
Use a derived table:
SELECT subtotal
, (subtotal * 0.5) as tax
FROM (select
(quantity * price) as subtotal
from table) t
Scott Thornburg
April 13, 2005 at 8:15 pm
Oh so you use a derived table!! Thanks guys.
You guys posted at the same time
April 13, 2005 at 8:24 pm
Fools think same way.
_____________
Code for TallyGenerator
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply