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

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

關(guān)于SQL 簡單的語法問題,isnull,內(nèi)容太長,具體的情況如下所示

關(guān)于SQL 簡單的語法問題,isnull,內(nèi)容太長,具體的情況如下所示

慕慕森 2021-05-30 09:06:08
簡單的sql語句,由于自己水平一般,不知道錯在哪里...忘熟悉語句的人指導(dǎo)一二,謝謝!select new_name as 年度,count(new_name) as 總份數(shù),round(sum(case new_q01 when '0' then filterednew_survey.new_q01when filterednew_survey.new_q01 is null then '0'else(filterednew_survey.new_q01-1.00)end),2) as 產(chǎn)品的銷售價格打分from filterednew_surveygroup by new_name為什么這句提示關(guān)鍵字 'is' 附近有語法錯誤???selectnew_name as year,count(new_name) as quantity,round(sum(isnull(new_q01,1.00)-1.00)/sum(casewhen new_q01 is null then 0else 1 end ),2) as 產(chǎn)品的銷售價格打分from filterednew_surveygroup by new_name這句沒有問題.selectnew_name as year,count(new_name) as quantity,round(sum(isnull(new_q01,1.00)-1.00)/sum(casewhen new_q01 is null then 0else 1 end ),2) as 產(chǎn)品的銷售價格打分from filterednew_surveygroup by new_name這句也沒有問題請各位指導(dǎo)下~~~經(jīng)過幾位的幫忙,我自己修改了一下,改成select new_name as 年度,count(new_name) as 總份數(shù),round(sum(case new_q01 when '0' then filterednew_survey.new_q01else (isnull(filterednew_survey.new_q01,1.00)-1.00)end),2) as 產(chǎn)品的銷售價格打分from filterednew_surveygroup by new_name也重新理解了下isnull但是有還是有點小小的不明白selectnew_name as year,count(new_name) as quantity,round(sum(isnull(new_q01,1.00)-1.00)/sum(casewhen new_q01 is null then 0else 1 end ),2) as 產(chǎn)品的銷售價格打分from filterednew_surveygroup by new_name為什么這句的也是is null then 0就可以呢?
查看完整描述

2 回答

?
慕少森

TA貢獻2019條經(jīng)驗 獲得超9個贊

select new_name as 年度,
count(new_name) as 總份數(shù),

round(sum(case isnull(new_q01,0) when '0' then '0'
else(filterednew_survey.new_q01-1.00) end),2) as 產(chǎn)品的銷售價格打分

from filterednew_survey
group by new_name

改成這個試一下

-------------------------------
when new_q01 is null then 0
else 1 end
這個是不行的 你會發(fā)現(xiàn) 不管他是不是null 他返回的都是1

查看完整回答
反對 回復(fù) 2021-06-07
?
拉風(fēng)的咖菲貓

TA貢獻1995條經(jīng)驗 獲得超2個贊

ISNULL使用指定的替換值替換 NULL。
語法
ISNULL ( check_expression , replacement_value )

IS NULL 是兩個關(guān)鍵字,在一起用是判斷指定的內(nèi)容是否是 null
兩個似乎沒有什么可比性

查看完整回答
反對 回復(fù) 2021-06-07
  • 2 回答
  • 0 關(guān)注
  • 457 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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