oracle sql語句錦集

2021-09-29 10:08:41 字數 2352 閱讀 9761

列出兩個月份之間所有的月份

在這裡插入**片select

//查詢出資料沒有的話就補0

在這裡插入**片select  a.monthlist,nvl(b.entry_count,0) as aaa from

(select

to_char( add_months( to_date(

'201904', 'yyyymm'

), rownum - 1 ), 'yyyymm'

) as monthlist

from

dual connect by rownum <= months_between(

to_date(

'201912', 'yyyymm'

), to_date(

'201904', 'yyyymm'

))+1) a

left join (select

time,

sum (entry_count) entry_count

from

( select

a . time,

sum (a .entry_count) entry_count

from

exp_hot_statistics a

where

1 = 1

and "substr"

(a . time, 0, 6) between '201903'

and '201912'

and (

key_word_type like '%奶粉%'

//列轉行並且時間按從小打到排序

select

listagg (time, ','

) within group (order by time asc) time,

listagg (entry_count, ','

) within group (order by time asc) entry_count_number,

key_word_type

from

( select

a . time as time,

a .key_word_type,

''|| sum (a .entry_count) entry_count

from

exp_hot_statistics a

where

1 = 1

and "substr"

(a . time, 0, 6) between '201902'

and '201911'

and (

key_word_type like '%奶粉%'

or key_word_type like '%運動鞋%'

http錯誤錦集

http 400 請求無效 http 401.1 未授權 登入失敗 http 401.2 未授權 伺服器配置問題導致登入失敗 http 401.3 acl 禁止訪問資源 http 401.4 未授權 授權被篩選器拒絕 http 401.5 未授權 isapi 或 cgi 授權失敗 http 403 ...

iscsi問題錦集

1.iscsi 客戶端discovery伺服器端操作失敗 解決 先執行 o new操作 iscsiadm m node t iqn.2010 06.de.boerse go disklesstest p 100.20.56.2 3260 o new 再執行discovery 以及login等操作 2...

簡單遞推錦集

1 走樓梯問題,乙個人剛開始站在第一級樓梯,每次可以走1級或者兩級,請問走到第n級樓梯有幾種走法?不容易系列之 3 lele 的rpg 難題有排成一行的 個方格,用紅 red 粉 pink 綠 green 三色塗每個格仔,每格塗一色,要求任何相鄰的方格不能同色,且首尾兩格也不同色 求全部的滿足要求的...