表A:
name date
A     2006-1-2
B     2006-1-2
A     2006-1-3
C     2006-1-2
得到以下结果:
name date
A     2006-1-2
B     2006-1-2
C     2006-1-2

解决方案 »

  1.   

    去除name值相同的记录,只留下一条
      

  2.   

    declare @t table(name char,date datetime)
    Insert @t select 'a','2006-1-2'
    Union all select 'b','2006-1-2'
    Union all select 'a','2006-1-3'
    Union all select 'c','2006-1-2'---
    Select * From @t A
    Where Not Exists
    (Select 1 From @t Where Name=A.Name and Date<A.Date)
      

  3.   

    --Or
    Select Name,Min(Date) as date
    From @t 
    Group By Name
      

  4.   

    要是date 相同那怎么办??
      

  5.   

    还有就是Select 1是什么意思
      

  6.   

    要是date 相同那怎么办??
    SELECT  DISTINCT name ,date