select pid,sum(iCount) from( select pid,1 as iCount,month(date) as iMonth from 考勤表 group by pid,date ) s group by pid,iMonth 问下yonghengdizhen(等季节一过,繁花就凋落) ,怎么解释阿?
可不可以。pid和date两个一起distinct
select pid,sum(iCount) from( select pid,1 as iCount,month(date) as iMonth from 考勤表 group by pid,date) s group by pid,iMonth
. 。。嗯。这样的。。我想到的办法。。虽然比较不好。不过可以解决。我已经测试过了。1。你先创建一个表。。有两个字段。。一个是pid 一个date。。 tablename:table1 insert talbe1 select DISTINCT pid,date (where between 你的年份 and 年份) from 原来的表 2。SELECT count(pid/date[随便选择一个查询,应该都可以的吧])from table1
from(
select pid,1 as iCount,month(date) as iMonth
from 考勤表
group by pid,date
) s
group by pid,iMonth
问下yonghengdizhen(等季节一过,繁花就凋落) ,怎么解释阿?
from(
select pid,1 as iCount,month(date) as iMonth
from 考勤表
group by pid,date) s
group by pid,iMonth
insert talbe1 select DISTINCT pid,date (where between 你的年份 and 年份) from 原来的表
2。SELECT count(pid/date[随便选择一个查询,应该都可以的吧])from table1