A
A
Anton2016-05-27 21:33:10
MySQL
Anton, 2016-05-27 21:33:10

How can a query be shortened with (NOT) LIKE?

There is a request with a bunch of NOT LIKE. They all refer to the same column in the table.
For example:

item_type NOT LIKE ? AND item_type NOT LIKE ? AND item_type NOT LIKE ? AND item_type NOT LIKE ? -- etc.

How can this be reduced in general in the SQL language? And how can this be shortened in Rails?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2016-05-27
@hummingbird

Is there any text at all? If yes, then only if regexp.
If not text (and if the text is exact, and not part of the %% of the string, then you can also not in), then why like, do it normally and not in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question