sql 如何在一个列中获取另一列计算出来的值
例如是否可以实现如下效果selecta+basc,c+dasefromdual一般情况下需要如下写selecta+basc,a+b+dasefromdual还有另一种方式...
例如是否可以实现如下效果
select a+b as c,c + d as e from dual
一般情况下需要如下写
select a+b as c,a+b+d as e from dual
还有另一种方式
select c,c+d as e from (
select a+b as c,d from dual
) t1 展开
select a+b as c,c + d as e from dual
一般情况下需要如下写
select a+b as c,a+b+d as e from dual
还有另一种方式
select c,c+d as e from (
select a+b as c,d from dual
) t1 展开
2016-05-25
展开全部
你两表关联後可以直接在select列表中计算并返回你要的值的
如select b.ematerial as 能源物质,b.e_code_id as 折标系数,b.e_consumption as 单耗散,e_consumption*enerty_real as 能耗值Q
from table1 a ,table2 b
where a.id = b.e_code_id
如select b.ematerial as 能源物质,b.e_code_id as 折标系数,b.e_consumption as 单耗散,e_consumption*enerty_real as 能耗值Q
from table1 a ,table2 b
where a.id = b.e_code_id
追问
你的回答好像不是我想要的,谢谢....
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |