2

有人问我是否有更好的方法来编写这个查询,我想不出。请帮忙:

 select bookid, bookname
   from books
  where bookname not like 'D%' or bookname not like 'F%'
4

1 回答 1

14
SELECT bookid,
       bookname
FROM   books
WHERE  bookname IS NOT NULL 

维护原始查询的语义。也许您打算使用AND而不是OR

SELECT bookid,
       bookname
FROM   books
WHERE  bookname NOT LIKE '[DF]%' 
于 2013-05-05T13:24:07.687 回答