mysql not in 和 not exits

Posted 正义的伙伴!

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql not in 和 not exits相关的知识,希望对你有一定的参考价值。

not exists 版本
SELECT
  org.*,
  u.rname AS uname
FROM
  exam_org org
  LEFT JOIN exam_user u
    ON org.ouid = u.uno WHERE NOT EXISTS
    (SELECT
      id
    FROM
      exam_org
    WHERE id IN (8,0)
      AND id = org.id)


not in 
SELECT
  org.*,
  u.rname AS uname
FROM
  exam_org org
  LEFT JOIN exam_user u
    ON org.ouid = u.uno WHERE id not in(8,0)
    
由此可见,对于没有子查询来说 ,not innot exists 应该是差不多的

 

以上是关于mysql not in 和 not exits的主要内容,如果未能解决你的问题,请参考以下文章

windows server 2008 安装MySQL 8.0 遇到报错 1055 - Expression #1 of ORDER BY clause is not in GROUP BY(示例代

Most basic operations in Go are not synchronized. In other words, they are not concurrency-safe.(示例代

gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting

解压报错gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exit

gzip: stdin: not in gzip format tar: Child returned status 1. tar Error is not recoverable: exiting

UnicodeEncodeError: ‘latin-1‘ codec can‘t encode characters in position: ordinal not in range(256)(代