I have data with column name authors
type text[]
like that: ["Mad Snail", "Jiang Ruotai"]
. I am using postgres and typeorm for doing it.
I want to select rows with condition field authors containing values that the user typed. I try to search gg but I got nothing.
For instance, the user typed: Jiang Ruotai. I will get rows with condition authors containing Jiang Ruotai.
How can I do that?
Use the ANY
operator. For example, if the variablesearch_term
holds the user's input, then search_term = ANY(authors)
is TRUE
when search_term
matches any of the author's names in the text array.