日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

sql語句例子一

系統(tǒng) 2103 0

declare @v_TradingTime datetime
set @v_TradingTime='2008-05-05'

select secucode,??
case sum(sign(updownratio))
??????when 3 then
?????? 1
??????when -3 then
?????? -1
??????else
?????? 0
?????? end as updown??
??????????????????
???????? --在這段時間(@v_TradingTime/dateadd(d,-20,@v_TradingTime))內(nèi)存在的記錄條數(shù)
???? from (select row_number() over(partition by secucode order by tradingtime desc) rn ,
???????? a.*
?????? from cha_quoteday a
??????where markettype in ('A股', 'B股')
????????and [close] > 0
????????and tradingtime <= @v_TradingTime
????????and tradingtime > dateadd(d,-20,@v_TradingTime)
????????and exists (select 1 from cha_quoteday c??????????
--@v_TradingTime 向前推20天內(nèi)存在的日期的數(shù)據(jù)
??????????where a.secucode = c.secucode
?????????? and c.tradingtime
=@v_TradingTime
?????????? and [close] > 0)
?????????????? ) b
?????????????? where rn<=3
?????????????? group by secucode
?????????????? having abs(sum(sign(updownratio))) = 3

?

?

2? ROW_NUMBER() OVER 與WITH AS 的用法

WITH orderList AS ( SELECT ROW_NUMBER() OVER (ORDER BY? Articletime DESC)AS Row, *
from Statistics_article
where Articletime between '2008-07-01' and '2008-12-2 0:00:00'? )
SELECT * FROM orderlist WHERE Row between 1 and 20

sql語句例子一


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。。?/p>

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 北辰区| 和平县| 江门市| 犍为县| 万州区| 亳州市| 马边| 乐都县| 西城区| 托克托县| 茌平县| 浦北县| 松桃| 武安市| 靖江市| 射阳县| 连云港市| 盐边县| 潜山县| 乌什县| 常德市| 英吉沙县| 泗水县| 固镇县| 信丰县| 德庆县| 凤台县| 松桃| 同仁县| 石台县| 女性| 旌德县| 民乐县| 彭山县| 时尚| 桦川县| 文化| 三明市| 红河县| 邮箱| 航空|