PostgreSQL
 SQL >> Database >  >> RDS >> PostgreSQL

PostgreSQL: cercare sottostringhe con LIKE ANY

Puoi usare LIKE ANY con una sottoquery:

SELECT uchastki.kadnum
FROM uchastki
WHERE kadnum LIKE ANY (
  SELECT str FROM test WHERE str IS NOT NULL
);

Puoi anche concatenare percentuali:

SELECT uchastki.kadnum
FROM uchastki
WHERE kadnum LIKE ANY (
  SELECT '%' || str || '%' FROM test WHERE str IS NOT NULL
);