//没相同数据意思表達不清?不相同記錄還是不相同的bookid?根據你的意思,覺得應該這樣寫select bookid from user where bookid not in(select bookid2 from info where info.isok=1)

解决方案 »

  1.   

    like this?
    select bookid from user 
    where bookid not in(select bookid2 from info)
    and isok=1
      

  2.   

    是这个意思,为什么使用 not exists 不行
      

  3.   

    select bookid from user  a where not exists(select bookid2 from info b where b.isok=1 and a.bookid = b.bookid2)
      

  4.   

    not exists应该也行,
    select bookid from user where not exists(select bookid2 from user.id = info.id and info where info.isok=1)
      

  5.   

    not exists应该也行,
    select bookid from user where not exists(select bookid2 from user.id = info.id and info where info.isok=1)