On Tue, 25 Nov 2025 08:33:07 -0800 (PST)
Rich Shepard <[email protected]> wrote:

> Companies can have slightly different titles for the same job; for example
> (using abbreviations). 'Asst Gen Mgr.', 'Env Mgr,', 'Gen Mgr,'. 'Mgr,',
> 'Plant Mgr.'
> 
> I want to select all people table rows that contain these varieties. I know
> the 'like' operator uses '%' as a wildcard, but is not accepted in an 'in'
> list.
> 
> Is there a way to use a multicharacter wildcard in an 'in' list?
> 

Hi Rich,

As Ron wrote, a regexp would do it, I guess?

SELECT * FROM people WHERE title ~ 'Asst Gen Mgr|Env Mgr|Gen Mgr|Mgr|Plant Mgr';

Although in your example, you would get the same result with just:

SELECT * FROM people WHERE title ~ 'Mgr';

https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP

-- 

                                        Bien à vous, Vincent Veyron 

https://marica.fr/ 
Logiciel de suivi des contentieux juridiques, des sinistres d'assurance et des 
contrats


Reply via email to