select 编号, Min(日期) AS 日期
from cust
group by 编号
order by 编号

解决方案 »

  1.   

    declare @t table (n int,c int,p datetime)insert into @t select 0,1,'2005-12-12'
    union all select 1,1,'2005-11-10'
    union all select 2,1,'2005-12-20'
    union all select 0,2,'2005-10-11'
    union all select 1,2,'2005-10-12'
    union all select 2,2,'2005-10-13'select 编号=a.c,最小日期=a.p
    from @t a where  not exists (select * from @t b where a.c=b.c and a.p>b.p)
    编号          最小日期                                                   
    ----------- ------------------------------------------------------ 
    1           2005-11-10 00:00:00.000
    2           2005-10-11 00:00:00.000