27,579
社区成员
发帖
与我相关
我的任务
分享
Title AnsterTime AnswerName
111 2011-01-01 00:00:00 BBB
111 2011-01-02 21:00:00 AAA
222 2011-01-02 22:00:00 BBB
333 2011-01-03 09:00:00 CCC
111 2011-01-03 20:00:00 BBB
222 2011-01-04 02:00:00 CCC
444 2011-01-04 03:00:00 CCC
..........
select count(*),answername from A where answertime>=? and answertime<=? group by answername
AnswerName count(*) Title次数
BBB 3 2 (一共有2个Title,111和222)
AAA 1 1 (一共有1个Title,111)
CCC 2 3 (一共有2个Title,333、222和444)
select count(*),count(distinct Title) as Title,answername
from A where answertime>=? and answertime<=? group by answername