这句select row_number() over (order by ProductID asc) as RowIndex,select row_number() over (order by ProductID asc) as RowIndex,p.ProductID,p.ProductName,p.CategoryID,p.Unit,p.UnitPrice,p.Quantity from Products as p where CategoryID = @CategoryID;
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 12:25:21
这句select row_number() over (order by ProductID asc) as RowIndex,select row_number() over (order by ProductID asc) as RowIndex,p.ProductID,p.ProductName,p.CategoryID,p.Unit,p.UnitPrice,p.Quantity from Products as p where CategoryID = @CategoryID;
这句select row_number() over (order by ProductID asc) as RowIndex,
select row_number() over (order by ProductID asc) as RowIndex,
p.ProductID,p.ProductName,p.CategoryID,p.Unit,p.UnitPrice,p.Quantity
from Products as p
where CategoryID = @CategoryID;
这句select row_number() over (order by ProductID asc) as RowIndex,
这句select row_number() over (order by ProductID asc) as RowIndex,select row_number() over (order by ProductID asc) as RowIndex,p.ProductID,p.ProductName,p.CategoryID,p.Unit,p.UnitPrice,p.Quantity from Products as p where CategoryID = @CategoryID;
这个是Oracle中比较常见的用法.
[TEST2@orcl#19-4月 -11] SQL>select * from a;
DTIME RCOUNT
---------- ----------
2011011101 2
2011011101 3
[TEST2@orcl#19-4月 -11] SQL>select row_number()over(order by dtime ) as rowseq,dtime,rcount from a;
ROWSEQ DTIME RCOUNT
---------- ---------- ----------
1 2011011101 3
2 2011011101 2
主要用于查询数据的时候显示序号.
over是Oracle的开窗函数.
over(order by dtime ) 就是按照dtime排序并进行累加.对什么累加呢?就是前面的row_number()系统函数.
你可以再试试sum(列)over(partition by id order by salary)等 可以求工资的累加和.