0

私はこのようなものを書くことができる方法を探しています

select complicated_calculation1 as comp1, 
complicated_calculation2 as comp2, 
(comp1/comp2) as percent
from table

このようにはるかに複雑な方法で書くのではなく

select complicated_calculation1 as comp1, 
complicated_calculation2 as comp2, 
(complicated_calculation1/complicated_calculation2) as percent
from table

これは可能ですか?

4

2 に答える 2

0

同じ列にはありません。

あなたができることは次のとおりです。

SELECT comp1, comp2, (comp1/comp2) as percent FROM(
select complicated_calculation1 as comp1, 
complicated_calculation2 as comp2
from table) AS t
于 2013-02-01T09:16:36.180 に答える
0
no u cann't use this 

select complicated_calculation1 as comp1, 
complicated_calculation2 as comp2, 
(comp1/comp2) as percent
from table

u have to use only this 

select complicated_calculation1 as comp1, 
complicated_calculation2 as comp2, 
(complicated_calculation1/complicated_calculation2) as percent
from table

because rantime calculation can not be applied on Alis field name
于 2013-02-01T09:22:05.357 に答える