我想根据一个表里的某个字段的值分别统计(按日期统计)出来的结果在同一个结果集中显示,请问如何做?例如,根据字段stat=1和=2分别按时间统计的结果:
date count1(stat=1) count2(stat=2)
--------------------------------------------
2005-7-1 1 4
2005-7-2 8 0
2005-7-3 2 9
...... .... .....
date count1(stat=1) count2(stat=2)
--------------------------------------------
2005-7-1 1 4
2005-7-2 8 0
2005-7-3 2 9
...... .... .....
(select date,count(*) count1 from table group by date) t,
(select date,count(*) count2 from table group by date) a
where t.date=a.date