PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
Database
[SQL ] 求多個區間的平均
作者:
lovebbw
(éžèƒ–勿擾)
2022-03-15 13:43:49
資料庫名稱:MySQL
資料庫版本:10
內容/問題描述:
時間 資料數值
1/1 100
1/2 200
1/3 300
1/4 50
1/5 100
請問我想要用一行指令算出
1/1~1/2的平均,1/3~1/4的平均,1/1~1/5的平均
請問該怎麼用?
目前想到的只有分成三個select 然後union起來才能在一次搜尋內做到
作者:
criky
(2501-2)
2022-03-18 06:51:00
select avg(case when date between 1/1 and 1/2 then dataelse null end),avg (case when date between 1/3 and 1/4then sata else null end),avg(data) from table
繼續閱讀
[SQL ] SQL 多個複雜查詢串接問題
kero961240
Re: [SQL ] 如何從mdb檔取出圖片
nwish
[SQL ] 請位欄位可以是變數嗎
tsongs
[SQL ] 如何從mdb檔取出圖片
demotion
徵求finereport家教
sleepyyy
Re: [SQL ] 計算良率join
konkonchou
[SQL ] 計算良率join
ctr1
[SQL ] SQL語法問題(UPDATE)
regress
[SQL ] Leetcode初階線上題目求解
applecream
[SQL ] 從Oracle資料庫撈資料,如何將中文編碼從
lueichun
Links
booklink
Contact Us: admin [ a t ] ucptt.com