第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如下程序,我該怎么把函數(shù)轉(zhuǎn)化為sql語句!急需指點(diǎn)!

如下程序,我該怎么把函數(shù)轉(zhuǎn)化為sql語句!急需指點(diǎn)!

慕村9548890 2022-12-15 17:13:15
create function [dbo].[dhp](@stcd varchar(10),@d1 varchar(100) )-- stcd 表示站點(diǎn)編號 d1表示時間returns decimalasbegindeclare @dhp decimalif (datename(hour,@d1)>'8')select @dhp= sum(drp) from st_pptn_r where stcd=@stcd and tm between @d1 and convert(varchar(100),year(dateadd(day,1,@d1)))+'-'+convert(varchar(100),month(dateadd(day,1,@d1)))+'-'+convert(varchar(100),day(dateadd(day,1,@d1)))+' 8:00:00'elseselect @dhp= sum(drp) from st_pptn_r where stcd=@stcd and tm between convert(varchar(100),year(dateadd(day,-1,@d1)))+'-'+convert(varchar(100),month(dateadd(day,-1,@d1)))+'-'+convert(varchar(100),day(dateadd(day,-1,@d1)))+' 9:00:00' and @d1return @dhpend 
查看完整描述

1 回答

?
桃花長相依

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超8個贊

select case when stcd='stcd' and tm between 'd1' and convert(varchar(100),year(dateadd(day,1,'d1')))
+'-'+convert(varchar(100),month(dateadd(day,1,'d1')))
+'-'+convert(varchar(100),day(dateadd(day,1,'d1')))
+' 8:00:00' then sum(drp) when stcd='stcd' and tm between convert(varchar(100),year(dateadd(day,-1,'d1')))
+'-'+convert(varchar(100),month(dateadd(day,-1,'d1')))
+'-'+convert(varchar(100),day(dateadd(day,-1,'d1')))
+' 9:00:00' and 'd1' then sum(drp) end drpsum from st_pptn_r你把'stcd'和'd1'換成具體值,試試看。

查看完整回答
反對 回復(fù) 2022-12-18
  • 1 回答
  • 0 關(guān)注
  • 152 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號