看板 Database 關於我們 聯絡資訊
※ 引述《JYHuang (夏天到了,冷不起來了說)》之銘言: : 其本上是分兩次查詢就可以完成 : select count(*) from table : select count(*) from table where xxx group by xx : ^^^^^ ^^^^^ ^^ 那要怎麼一次查詢就把兩種資料取出來呢? ==>原則上,Group by應該與Having子句一併使用,較少與 where子句併用;因為既然用了Group by(群組化),所 針對處理的是群組的資料,而非where子句在處理的單 一筆record! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.225.66.150