mysql:
select a.footer_id from footer a, cons b where a.footer_id <> b.footer_id这样子不知道行不行?楼主试试看。

解决方案 »

  1.   

    用 LEFT JOIN 试试SELECT footer.footer_id  FROM footer LEFT  JOIN cons ON footer.footer_id=cons.footer_id WHERE cons.footer_id IS  NULL;希望没打错字,我在我现有的表里能行,只是结构有点不同.
      

  2.   

    还可以用not in 和not exists ,如果是4.1版本的mysql
      

  3.   

    left join其实就是left outer join ????
      

  4.   

    bflovesnow() 
    晕S,2 楼的写法毫无意义的啊,差不多是一个 迪卡尔 乘积的结果啊。
    ----------------
    我也不喜欢用LEFT JION,效率不好.可毕竟可以先把问题解决掉.
    我也想知道别的好方法.waiting....
      

  5.   

    2楼的虽然算法不好,但确实可以得到正确的结果select a.footer_id from footer a where not exists (select footerid from cons)
    不知道写对了没有,没有测试
      

  6.   

    不知道你们说的那个2楼到底是哪个?
    用<>那个是不行的。
    left join / not exists / not in 都是可以的,以前有过一样的帖子
      

  7.   

    不过楼上的写的不对,应该是
    select footer.footer_id from footer where not exists 
    (select footerid from cons where footerid=footer.footer_id)