“<>” vs “NOT IN”

后端 未结 9 1474
Happy的楠姐
Happy的楠姐 2020-12-14 17:53

I was debugging a stored procedure the other day and found some logic something like this:

SELECT something
FROM someTable
WHERE idcode <> (SELECT ids          


        
9条回答
  •  轮回少年
    2020-12-14 18:07

    try this, may run faster because of index usage:

    SELECT something
    FROM someTable
        LEFT OUTER JOIN tmpIdTable ON idcode=ids
    WHERE ids IS NULL
    

提交回复
热议问题