select username into :name[] from tablename
for i=1 to upperbound(name[])
select logintime into :yeardatetime[] from tablename where username=:name[i]
select logintime into :yeardate[] from tablename where username=:name[i]
next
for i=1 to upperbound(name[])
later[i]=yeardatetime[i]-yeardate[i] //迟到时间数组
next