select distinct 卡号,人名,日期 from tablename

解决方案 »

  1.   

    用SELECT-SQL来做:
    select 卡号,人名,日期 from 考勤表 distinct也可以用索引来做:(VFP中的)
    index on 日期 tag rq
    然后设置此索引为主控索引即可。
      

  2.   

    其实用不着,就是access数据库。szjhxu(天野) 兄的写法似乎有错。我现在已经得到部份结果,结构是:卡号、人名、日期、时间、门号
    CardNo HolderName   IODate IOTime IOGateNo
    0003 abcccc    2002-7-3 08:51:30 02-1
    0003 abcccc    2002-7-3 09:15:20 02-1
    0003 abcccc    2002-7-4 09:05:20 02-1 一个人一天之内可能多次出入大门,但我只要最早的那条记录。我该怎么写
      

  3.   


    卡号      人名        日期           时间     门号
    0003 abcccc    2002-7-3 09:05:20 02-1
    0003 abcccc    2002-7-3 09:15:20 02-1
    0003 abcccc    2002-7-4 09:15:20 02-1  一个人一天之内可能多次出入大门,我只需要时间最早的那条记录,该怎么办??
      

  4.   

    怎么用first?我不太明白,能不能说清楚些。
      

  5.   

    为什么select .... from order by 时间呢?
    选出来就是最早的一条啊。
      

  6.   

    select a.card_no,a.name,a.door_no,b.inout_time from tablename a join (
     select card_no,door_no,min(inout_time) group by card_no,door_no) b
     on a.card_no=b.card_no and a.door_no=b.door_no and a.inout_time=b.inout_time
      

  7.   

    order by 时间?但我只要最早进入公司的那条记录,一个人一天之内是会多次
    进出公司的。我现在还是没有找到合适的SQL语句来做。
      

  8.   

    你的表建立有 id 字段,如果在同一天里面,时间靠后的 id 值 大 的话 就很好办了将时间等效idselect * form tbl where id in (select min(id) group by 日期)
      

  9.   

    select * from tbl where id in (select min(id) from tbl group by 日期)