--查询
select * from 表 a
where 时间=(
select min(时间) from 表 
where 时间>=convert(varchar(13),a.时间)+':00')

解决方案 »

  1.   

    --测试--测试数据
    create table 表(id int,时间 datetime,data int)
    insert 表 select 1,'2004-3-19 1:00:00',200
    union all select 2,'2004-3-19 1:03:00',400
    union all select 3,'2004-3-19 2:00:00',300
    union all select 4,'2004-3-19 2:01:00',800
    union all select 5,'2004-3-19 3:00:00',700
    union all select 6,'2004-3-19 3:01:00',700
    union all select 7,'2004-3-19 3:02:00',200
    go--查询
    select * from 表 a
    where 时间=(
    select min(时间) from 表 
    where 时间>=convert(varchar(13),a.时间)+':00')go--删除测试
    drop table 表/*--测试结果
    id          时间                                                     data        
    ----------- ------------------------------------------------------ ----------- 
    1           2004-03-19 01:00:00.000                                200
    3           2004-03-19 02:00:00.000                                300
    6           2004-03-19 03:01:00.000                                700(所影响的行数为 3 行)
    --*/
      

  2.   

    --测试--测试数据
    create table 表(id int,时间 datetime,data int)
    insert 表 select 1,'2004-3-19 1:00:00',200
    union all select 2,'2004-3-19 1:03:00',400
    union all select 3,'2004-3-19 2:00:00',300
    union all select 4,'2004-3-19 2:01:00',800
    union all select 5,'2004-3-19 3:00:00',700
    union all select 6,'2004-3-19 3:01:00',700
    union all select 7,'2004-3-19 3:02:00',200
    go--查询
    select * from 表 a
    where 时间=(
    select min(时间) from 表 
    where 时间>=convert(varchar(13),a.时间)+':00')go--删除测试
    drop table 表/*--测试结果
    id          时间                                                     data        
    ----------- ------------------------------------------------------ ----------- 
    1           2004-03-19 01:00:00.000                                200
    3           2004-03-19 02:00:00.000                                300
    5           2004-03-19 03:00:00.000                                700(所影响的行数为 3 行)--*/
      

  3.   

    再问一下如果是
    字段
    id        时间              data
    1   2004-3-19 1:01:00        200
    2   2004-3-19 1:02:00        400
    3   2004-3-19 1:03:00        300
    4   2004-3-19 1:04:00        800
    5   2004-3-19 2:00:00        700
    6   2004-3-19 2:01:00        700
    7   2004-3-19 2:02:00        200
    的话要取分钟值怎么取!!!