想知道mysql中的not in怎么使用

解决方案 »

  1.   

    select * from table1 where id not in (1,2,3,4,5)
      

  2.   


    MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  3.   

    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
      

  4.   

    具体是什么问题?
    select * from tt where id not in(1,2,3)
      

  5.   

     select * from tableA 
    where id not in (select id from tableB)
      

  6.   


    就是说从tt表中查询数据,并且id字段的值不等于1,2,3中的任何一个值
      

  7.   


    select * from tt where id not in(1,2,3)

    select * from tt where id <>1 and id <>2 and id <>3
    的意思一样
      

  8.   

    select * from tb where id not in(1,3,5,7);