我想这样行不行,先从表内取得一个最小的时间,然后用它+3小时,然后用select把>=最小时间和<=+3小时后的时间的这段内容取出来放一个新表。用while循环做,直到affectedrow=0为止。

解决方案 »

  1.   

    select CurrAll, CurrTime from table A
    where currtime in (
    select top 1 currtime from table 
    where currtime > datediff(hour,3,A.currtime)
    order by currtime
    )
      

  2.   

    我本来想帮楼主做一下,就建了个表
    create table A
    (currall float,currtime datetime)
    然后把楼主的表贴到d:\aaaa.txt里,
    然后执行
    bulk insert A
    from 'd:\aaaa.txt'
    with(fieldterminator='  ',rowterminator='\n')
    结果发现select * from A结果却是:
    158.63'  2004-06-08 09:42:00.000
    158.68000000000001'  2004-06-08 09:44:00.000
    159.22'  2004-06-08 10:07:00.000
    159.27000000000001'  2004-06-08 10:09:00.000
    159.31999999999999'  2004-06-08 10:11:00.000
    159.96000000000001'  2004-06-08 10:38:00.000
    160.00999999999999'  2004-06-08 10:40:00.000
    160.06'  2004-06-08 10:42:00.000
    160.11000000000001'  2004-06-08 10:44:00.000
    160.16'  2004-06-08 10:46:00.000
    160.84'  2004-06-08 11:10:00.000
    160.91'  2004-06-08 11:12:00.000
    160.97999999999999'  2004-06-08 11:14:00.000
    161.05000000000001'  2004-06-08 11:17:00.000
    161.12'  2004-06-08 11:19:00.000
    我原样导入的数据怎么有的是2位小数有的却变了呢?
    请知情者点拨