Thread: partial text search
> Hi,
>
> my task is to search partial text in the fields mentioned in query. Basically I have to tables t1 and t2 and I need to search in t1 all the codes returned by a query from t2. In t1 the values could be identical as in t2 or could be partial. For example.
>
> T1:
>
> Description
>
> 190201 – is not our student
>
> 190202 – is …
>
> 190202
>
> T2:
>
> Description
>
> 190202
>
> My query should return for item “190202” from t2 all the columns where this text is found in t1, but not necessary identical. The result will be the last two rows from T1:
>
> 190202 – is …
>
> 190202
>
> I have tried something similar with the following:
>
> SELECT description FROM t1 WHERE description LIKE '195004'
>
> Instead of ‘195004’ I would like to put one by one all elements returned by another query:
>
> SELECT description FROM t2
>
> Any idea how to do that?
>
> I was looking on the partial text search with tsvector and tsquery, but I’m not sure how to put the queries should be something like this:
>
> SELECT to_tsvector(t1.description) @@ to_tsquery(SELECT description FROM t2);
>
> Thank you.