读书人

Oracle语法的一个小疑点

发布时间: 2013-06-19 10:26:41 作者: rapoo

Oracle语法的一个小问题
在表emp中 列出工资最小值小雨等于2000的职位

select job,min(sal)
from emp
where mina(sal)<=2000;为什么不对

为什么要写成
select job,min(sal)
from emp
group by job
having min(sal)<=2000;

group by 到底 有什么用
[解决办法]
select 非聚合函数列,需要用group by
[解决办法]
查看Group by的语法
Select [filed1,fild2,]聚合函数(filed),
[Grouping(filed),]
[Grouping_id(filed1,filed2,…)]
From tablename
Where condition
[Group by {rollup
[解决办法]
cube}(filed,filed2)]
[having condition]
[order by filed1]

读书人网 >SQL Server

热点推荐