只要其中的一条,好办
select top 1 ContractID, ProductName, Spec, Unit, Memo
from Repository
where ContractID IN (select distinct ContractID from Repository
 where RecordType = 1 ) and ActionDate between '2003-2-1' and '2003-2-28'

解决方案 »

  1.   

    混分无极限
    不兼容又到此混分 ;)
        ("`-''-/").___..--''"`-._ 
         `6_ 6  )   `-.  (     ).`-.__.`) 
         (_Y_.)'  ._   )  `._ `. ``-..-' 
       _..`--'_..-_/  /--'_.' ,' 
      (il),-''  (li),'  ((!.-' 
     
      不兼容 的形象大使,欢迎盗版!
      

  2.   

    select identity(int,1,1) ID,* into #t1 from Repository
    where RecordType = 1 and ActionDate between '2003-2-1' and '2003-2-28'select ContractID, ProductName, Spec, Unit, Memo
    from #t1
    where ID IN (select min(ID) from #t1 group by ContractID)
      

  3.   

    谢谢  OpenVMS(半知半解) !!!!!!呵呵,这也是我在 CSDN 上面发贴以来,第一次从 坛子里面得到答案。
    以前的帖子都是我自己最终找到解决的办法 :-POpenVMS(半知半解) 的第一个办法是不行的。因为同时要检索出所有的不重复记录。
    所以,用创建临时表,在从临时表里检索的方法 最终检出了正确的结果