select distinct  '003',enterdate from tab where enterdate not in (select enterdate from tab where UserAccount ='003')
  
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 最新版本:20070212http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html

解决方案 »

  1.   

    create table T(UserAccount varchar(10), enterdate datetime) 
    insert T select '001',             '2006-09-08'
    union all select '002',             '2006-09-08'
    union all select '001',             '2006-09-09'
    union all select '002',             '2006-09-09'
    union all select '003',             '2006-09-09'select tmp.* from 
    (
    select * from  (select distinct UserAccount from T) A,
    (select distinct enterdate from T) B
    where 1=1
    )
    tmp left join T on tmp.UserAccount=T.UserAccount and tmp.enterdate=T.enterdate
    where T.UserAccount is null--result
    UserAccount enterdate                                              
    ----------- ------------------------------------------------------ 
    003         2006-09-08 00:00:00.000(1 row(s) affected)
      

  2.   

    marco08天道酬勤,每次你都帮我大忙呢,哈哈,谢谢,给你分了,