作者diamondking (天剑流星)
看板Database
标题Re: [SQL ] 想要查询各笔资料的数目和总和
时间Fri Sep 14 20:33:46 2007
※ 引述《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