0

I am working with a table (essentially a list of words, i.e. a dictionary'), and had the need to create a subset of items from that table that only contained 3 certain characters, let's say, 'A', 'P', and 'Z'.

Obviously, I can use GLOB or LIKE, like so:

WHERE Word LIKE '%A%' AND Word LIKE '%P%' AND Word LIKE '%P%'

...but I seem to recall once doing a similar thing with a single GLOB statement, although I cannot locate the code where I did that. After a search of the web, and even a consultation with ChatGPT (which informs me that it's not possible, for whatever that's worth!), I thought I'd ask here.

I attempted various combinations of GLOB patterns using NOT and the ^ negation character, all to no avail, although I seem to recall that this is how I once successfully tackled the problem.

1 Answer 1

0

And, would you know it, I just recalled the project where I did this, but I'm leaving the question up as it's probably interesting to somebody!

SELECT Word 
FROM Words 
WHERE NOT 'ZAP' GLOB '*[^' || Word || ']*';

Basically, swap the 'search in' term with the 'search for' term, and use NOT with the ^ operator.

I knew I wasn't going crazy!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.