Select NO From 表 Where InsTime In (Select Max(InsTime) From 表 Group By Client)

解决方案 »

  1.   

    select no
    from t a
    where instime=(select top 1 instime from t where client=a.client order by instime desc)
      

  2.   

    select no
    from t a
    where not exists(select 1 from t where client=a.client and instime>a.instime)
      

  3.   

    按时间分组,GRUOP BY   然后MAX就可以了
      

  4.   

    select no
    from t a
    where not exists(select 1 from t where client=a.client and instime>a.instime)
      

  5.   

    这种情况,如果刚好Client:SD与SH的InsTime存在完全相同的话,就可能会多出数据来?
      

  6.   

    用这个试了么??? 不会重复的 
    select no
    from t a
    where not exists(select 1 from t where client=a.client and instime>a.instime)
      

  7.   

    NO       Client   InsTime
    ------------------------------------------
    No1 SD 2004-11-01
    NO2 SH 2004-11-01
    NO3 SH 2004-11-02
    NO4 SD 2004-11-01
    你用这个试,就出来3条
      

  8.   

    select no
    from t a
    where no=(select top 1 no from t where client=a.client order by instime desc)