在informix中进行统计
create table userinfo
(
id int not null,
downdate datetime year to seconddefault current year to second not null
)
要求统计以上表id值相同并且在同一天的数据的集合
大致的sql是这样的,
select count(id),id,date(downdate) from userinfo group by id,date(downdate)
这条sql是错误的,
[解决办法]
select id,date(downdate),count(id) from userinfo group by 1,2
[解决办法]
select count(id),id,substr(downdate,0,10) as downdate from userinfo group by 1,2;
substr(downdate,0,10)这个可以截取日期
[解决办法]
你多了个逗号
select count(id) id,substr(downdate,0,10) as downdate from userinfo group by 2;