How do I add multiple "NOT LIKE '%?%' in the WHERE clause of sqlite3?

前端 未结 7 2106
无人及你
无人及你 2020-12-23 20:06

I have a sqlite3 query like:

SELECT word FROM table WHERE word NOT LIKE \'%a%\';

This would select all of the words where \'a\' does not oc

相关标签:
7条回答
  • 2020-12-23 20:36

    I'm not sure why you're avoiding the AND clause. It is the simplest solution.

    Otherwise, you would need to do an INTERSECT of multiple queries:

    SELECT word FROM table WHERE word NOT LIKE '%a%'
    INTERSECT
    SELECT word FROM table WHERE word NOT LIKE '%b%'
    INTERSECT
    SELECT word FROM table WHERE word NOT LIKE '%c%';
    

    Alternatively, you can use a regular expression if your version of SQL supports it.

    0 讨论(0)
提交回复
热议问题