㈠ 我们每天的行程数据是否都被记录在数据库中记录多少天
所有的数据都会被记录下来的,一般显示的都是最近14天的。
是通过手机的基站信息确定的,所以你的手机需要和基站进行通信才可以确定行程。如果在异地拨打了电话,就会记录下你的位置。
行程码国内精确到省市停留4小时以上就会有记录,不需要填报信息就可以查询到自己在前14天内国内停留4小时的城市与到访其他国家的,查询由用户主动发起,可用手机软件(微信、支付宝等)扫码接入查询页面,或微信小程序搜索通信行程卡进入小程序,输入手机号码并点击获取验证码,验证成功后点击查询,即可返回查询结果。。
㈡ 用 sqlserver 怎样查询出 数据表里 某月上班连续打卡15天的人
以下以2013年11月为例
1、使用横向连接,以5天为例,简单但不易扩展
with data as ( select * from yourtable where date>='2013-11-01' and date<'2013-12-01')
select distinct name
from data t1 join data t2 on t1.name=t2.name and t1.date=t2.date+1
join data t3 on t2.name=t3.name and t2.date=t3.date+1
join data t4 on t3.name=t4.name and t3.date=t4.date+1
join data t5 on t4.name=t5.name and t4.date=t5.date+1
2、使用纵向分组统计
with t1(id,rq) as (
select distinct 人员, date from 表 where date>='2013-11-01' and date<'2013-12-01' ),
--t1求出指定月的人员编号及不同的打卡日期
t2 as (select s2.* from t1 s1 join t1 s2 on s1.id=s2.id and s1.rq=s2.rq-1),
--t2求出所有上一日也打过卡的日期
t3 as (select * from t1 except select * from t2),
--t3求出所有上一日未打过卡的日期
t as (
select id,rq,1 days from t3
union all
select t1.id,t1.rq,t.days+1 from t1 join t on t1.id=t.id and t1.rq=t.rq+1
)
--t4递归调用,每连续一日days+1,就是求每一打卡时间是连续的第几天
select id
from t
group by id
having max(days)>=5
order by id
以上就不删了,以下可以改短点吧
with t as (
select 人员 id, date rq, 1 days from 表 t1
where not exists(select * from 表 t2 where t2.date=t1.date-1)
union all
select t1.id,t1.rq,t.days+1 from 表 t1 join t on t1.id=t.id and t1.rq=t.rq+1
)
select id
from t
group by id
having max(days)>=5
order by id