具体记录和要求是这样的!ACCESS 中表 TTGR 中 第一列 为 "工作批号" 第二列 为 "时间" 第三列为" 温度01" 第四列为 ID 号记录的数据举例:
  工作批号 时间 温度01 ID
  20100123 11:23:34 112 1
  20100123 11:24:34 112 2
  20100123 11:25:34 112 3
  20100123 11:26:34 112 4
  20100123 11:27:34 112 5
  20100123 11:28:34 112 6
  20100123 11:29:23 112 7   
  20100123 11:29:34 112 8   
  20100123 11:30:34 112 9
  20100123 11:31:34 112 10
  20100123 11:32:34 112 11
  20100123 11:33:34 112 12
  20100123 11:34:34 112 13
  20100123 11:35:34 112 14
  20100123 11:36:34 112 15
  20100123 11:37:34 112 16
  20100123 11:38:34 112 17
  20100123 11:39:34 112 18
  20100123 11:40:34 112 19
  20100123 11:41:34 112 20
  "红色的数据"   
  表的数据中,在工作批号一样的数据记录中,判断数据是否有 象红色数据的存在;只拿" hh:mm "判断;存在!
  并使用语句形成判断! 来确定!  如果有执行一个事件;如果没有就执行另一个事件!
  能否给点源码!
"时间" 字段是时间/日期
"工作批号"字段在数据库里是文本类型 !

解决方案 »

  1.   

    select 工作批号,left(时间,5) as 时间 from ttgr group by 工作批号,时间 having count(*)>1
      

  2.   

    Leftie:select 工作批号,left(时间,5) as 时间 from ttgr group by 工作批号,时间 having count(*)>1程序:
    "工作批号" 为变量 在程序里变量代号为 Strding   Dim Strding as String请问如何写进去!!!
      

  3.   

    select 1 
    from TTGR a,TTGR b
    where a.工作批号=b.工作批号
    and format(a.时间,'yyyymmddhhmm')=format(b.时间,'yyyymmddhhmm')
    and a.ID>b.ID用ADO打开上面这个SQL语句,如果空集则说明没有重复的,如果结果非空则说明有重复的。
      

  4.   

     
    ACMAIN_CHM:  
    你好!
    select 1 
    from TTGR a,TTGR b
    where a.工作批号=b.工作批号
    and format(a.时间,'yyyymmddhhmm')=format(b.时间,'yyyymmddhhmm')
    and a.ID>b.ID
    请问我如何程序:
    "工作批号" 为变量 在程序里变量代号为 Strding   Dim Strding as String请问如何写进去!!!我原程序:
    Adodc1.RecordSource = "select * from TTGR where 工作批号='" & Strding & "'order by ID"
    Adodc1.Refresh
      

  5.   

    "select 工作批号,left(时间,5) as 时间1 from ttgr where 工作批号='" & Strding &"' group by left(时间,5) ,工作批号 having count(*)>1"