34,873
社区成员
发帖
与我相关
我的任务
分享
declare @接收表 table (编号 int,手机号 bigint,短信内容 varchar(1),时间 datetime)
insert into @接收表
select 1,13000000000,'a','2009-04-21 01:02:00.000' union all
select 2,13000000000,'a','2009-04-21 01:02:00.000' union all
select 3,13000000001,'a','2009-04-21 00:00:00.000'
select 手机号,时间 from @接收表 group by 手机号,时间
/*
手机号 时间
-------------------- -----------------------
13000000000 2009-04-21 01:02:00.000
13000000001 2009-04-21 00:00:00.000
*/
select count(*)
from (
select 1
from tb
group by 手机号,时间
) t
万一插的时间不同你这就不准了。
select count(*)
from (
select 1
from tb
group by 手机号,时间
) tselect count(*)
from tb
group by 手机号,时间