SELECT uid,MIN(loginTime)
FROM @tb
WHERE loginTime BETWEEN @dtTimeBegin AND @dtTimeEnd
GROUP BY uid
select top 1 uid,loginTime from 表 where loginTime BETWEEN 开始时间 AND 结束时间 order by loginTime asc
SELECT MIN(loginTime) ,uid FROM tabel WHERE loginTime BETWEEN '2009-1-2' AND '2009-1-15' GROUP BY uid