结果输出格式是这样的
+-----------+------------ 
| OldTotal  | NewTotal  | 
+-----------+------------
 402432092 |  402689714 | 

解决方案 »

  1.   

    select min(OldTotal) OldTotal,max(NewTotal) NewTotal,OldTime from a group by OldTime order by OldTime
      

  2.   

    select min(OldTotal) OldTotal,max(NewTotal) NewTotal from a
      

  3.   

    --> Test Data: @T
    declare @T table ([OldTotal] int,[NewTotal] int,[OldTime] datetime)
    insert into @T
    select 402432092,402484948,'2009-04-20 00:16:01' union all
    select 402484948,402524886,'2009-04-20 01:16:01' union all
    select 402524886,402556903,'2009-04-20 02:16:01' union all
    select 402556903,402584875,'2009-04-20 03:16:01' union all
    select 402584875,402603597,'2009-04-20 04:16:01' union all
    select 402603597,402621711,'2009-04-20 05:16:01' union all
    select 402621711,402642656,'2009-04-20 06:16:01' union all
    select 402642656,402663625,'2009-04-20 07:16:01' union all
    select 402663625,402689714,'2009-04-20 08:16:01'--select * from @T
    --Code
    select * from
    (select OldTotal from @t a where OldTime=(select min(OldTime) from @t))a,
    (select NewTotal from @t a where OldTime=(select max(OldTime) from @t))b--Drop--Result
    /*
    OldTotal    NewTotal    
    ----------- ----------- 
    402432092   402689714
    */
      

  4.   

    select * from
    (select OldTotal=min(OldTotal) from @t a where OldTime=(select min(OldTime) from @t))a,
    (select NewTotal=max(NewTotal) from @t a where OldTime=(select max(OldTime) from @t))b
      

  5.   

    select min(OldTotal) OldTotal,max(NewTotal) NewTotal from a;
      

  6.   

    感谢各位专家~~!!!方法都很好,我采用wxg22526451的 多谢了!