Re: [SQL ] 想要查詢各筆資料的數目和總和

看板Database作者 (天劍流星)時間18年前 (2007/09/14 20:33), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/6 (看更多)
※ 引述《JYHuang (夏天到了,冷不起來了說)》之銘言: : 其本上是分兩次查詢就可以完成 : select count(*) from table : select count(*) from table where xxx group by xx : 那要怎麼一次查詢就把兩種資料取出來呢? select a.*, (select count(1) from table) from ( select id, count(1) from table where .... group by id ) 如此即可 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.167.210.145
文章代碼(AID): #16wd-h4s (Database)
討論串 (同標題文章)
文章代碼(AID): #16wd-h4s (Database)