--日常使用的sql语句和oracle语句,有些相对使用的频率比较高,收藏起来还是比较值得的 -- 绝对值 SQL:) value Oracle:) value from dual -- 2.取整(大) SQL:select ceiling(-1.001) value Oracle:select ceil(-1.001) value from dual -- 3.取整(小) SQL:select floor(-1.001) value Oracle:select floor(-1.001) va…
sql版本 select * from (select t.CloseDate,t.ExpiryDate,t.DataTypeLookupID,ROW_NUMBER() over(partition by CloseDate,ExpiryDate,DataTypeLookupID order by CloseDate,ExpiryDate,DataTypeLookupID) as new_index from dbo.IndexVolatilityMarketData t ) a where a…
方法一 select t1.a,t1.b,t1.c from test t1 inner join (seelct a,max(b) as b from test group by a) t2 on t1.a=t2.a and t1.b=t2.b 方法二 select * from (select t.*, row_number() over(partition by 分组字段 order by 排序字段 desc ) rnfrom tablename t )where rn=1 方法三 (不一…
http://blog.csdn.net/winter13292/article/details/7011377 SQL 对大小写不敏感! 在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与合计函数一起使用. eg: SELECT Customer,SUM(OrderPrice) FROM Orders WHERE Customer='Bush' OR Customer='Adams' GROUP BY Customer HAVING SUM(OrderPrice)>150…
CREATE OR REPLACE PROCEDURE proc_Insert_BookKindList ( temTypeName nvarchar2, temParent int ) AS ncount number; begin --SELECT COUNT (*) INTO ncount FROM BookKindList fm1 where EXISTS (SELECT BookKindName from BookKindList fm2 where fm2.BookKindName=…
1.利用group by 去重复 2.可以利用下面的sql去重复,如下 1) select id,name,sex from (select a.*,row_number() over(partition by a.id,a.set order by name) su from test a ) where su=1 2)select id,name,sex from (select a.*,row_number() over(partition by a.id,a.sex order by n…
CursorsYou use a cursor to fetch rows returned by a query. You retrieve the rows into the cursor using aquery and then fetch the rows one at a time from the cursor. You typically use the following fivesteps when using a cursor:1. Declare variables to…