作者webber1984 (阿浪)
看板Database
標題[SQL ] Having的疑問
時間Thu May 18 21:20:42 2017
(針對
SQL 語言的問題,用這個標題。請用 Ctrl+Y 砍掉這行)
資料庫名稱:MySQL
資料庫版本:6.3 CE
內容/問題描述:
MySQL才剛進入沒有多久
前輩傳了這一段給我,但我沒有很清楚要怎麼修改,也沒有辦法執行
所以想詢問版上大大的意見,感謝各位
select count(distinct servicer) as 'new'
from (
select servicer from abc vo
where order_group = 1 and order_status in (1,2,6)
group by vo.servicer
having min(vo.order_datetime) >= %(date1)s
and min(vo.order_datetime)< %(date2)s) new
;
在最後的一段的having這一段,不知道怎麼修改及含意是什麼,想請問一下各位大大了
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.23.16.79
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Database/M.1495113644.A.738.html
1F:推 criky: having就篩選函數值,看起來是選一段時間內的資料 05/19 07:24
2F:→ dodobear: 不知道用%是什麼意思 05/25 17:16