B
B
beduin012019-03-26 11:12:44
PostgreSQL
beduin01, 2019-03-26 11:12:44

Is it possible to organize a fuzzy search for occurrences?

It is necessary to select from the base all incomplete occurrences.
Relatively speaking:
SELECT * FROM mytable where okpd2_code IN ('26.51.20')
It is necessary to return all records that have more than digits:
26.51.20.121
26.51.20.123
26.51.20.312
26.51.20.848
There can be a lot of values ​​inside IN. And it is necessary that each was processed in a similar way.
etc. Can this be done in Postgress? If so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dddead, 2019-03-28
@dddead

as an option to use regular expressions:
SELECT * FROM mytable where okpd2_code ~ '^(var1|var2|...|varN)'
e.g.
SELECT * FROM mytable where okpd2_code ~ '^(26\.51\.20\.|22\. 55\.20\.)'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question