好:
  我现在有个表里面全是用户信息的数据,
然而,我每天都将对每个用户拥有一个当天的记录,也就是说,每天所有用户都要
在另外一个表里面存在...但我怎么查询不存在的用户呢???

解决方案 »

  1.   

    select distinct 客户姓名 from 客户表
    except
    select distinct 客户姓名 from 记录表
      

  2.   

    select *from 记录表 where not exists(select *from 用户表 where 用户表.id=记录表.id and 
    date='2010-11-08')
      

  3.   


    Select * from 用户表 where id not in(
    (select id from 用户表,记录表 where 用户表.id=记录表.id and 用户表.时间=记录表.时间))
      

  4.   

    select *from 记录表 where not exists(select *from 用户表 where 用户表.id=记录表.id) and 
    date='2010-11-09'
      

  5.   

    select
     *
    from
     记录表
    where 
     not exists(select1 from 用户表 where 用户表.id=记录表.id and date='2010-11-08')
      

  6.   

    select
     *
    from
     记录表
    where 
     not exists(select 1 from 用户表 where 用户表.id=记录表.id and date='2010-11-08')