需要sql查询信息 [英] sql query info needed
本文介绍了需要sql查询信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表格
创建 表 emp(sal number,comm number);
查询
选择 sal,comm,sum(sal + comm)进入总来自 \\ temp 其中 comm 不 null ;
Emp表有两列'sal'和'comm'。我想显示sal和comm以及sal和comm的总数,其comm不为null但我收到上述查询的错误。
解决方案
我想你与sqlinto混合。
sql用于将记录从一个表复制到另一个表
ref这里。
https://msdn.microsoft.com/en-us/library/ms188029.aspx [ ^ ]
http://www.w3schools.com/sql/sql_select_into.asp [ ^ ]
i想你想要这样..
选择sal,comm,(sal + comm)作为emp的总数,其中comm不为null;
My table emp
create table emp(sal number,comm number);
Query
select sal,comm,sum(sal+comm) into total from emp where comm is not null;
Emp table has two columns 'sal' and 'comm'. I want to display sal and comm as well as total of sal and comm whose comm is not null but I'm getting error for above query.
解决方案
i think you are mixedup with the sqlinto.
sql into use to copy record from one table to another table
ref here.
https://msdn.microsoft.com/en-us/library/ms188029.aspx[^]
http://www.w3schools.com/sql/sql_select_into.asp[^]
i think you want like this..
select sal,comm,(sal+comm) as total from emp where comm is not null;
这篇关于需要sql查询信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文