I'm coding a query in my NestTs project, so I would like to retrieve information matched with LIKE clause values.
The problem with my query is the table has three types of records _INFORMED, _UNINFORMED and WITHOUT. If I use the sentence
.where("user.firstName like :name", { name:`%_INFORMED%` })
... It matches with _INFORMED and _UNINFORMED records, then I tried to use the wildcard character as to standard SQL: '%\\_INFORMED%' but it looks wrong.
Do you have any idea? Thanks!
Edit:
Full TYPEORM query:
.createQueryBuilder(Stage, 's')
.innerJoin('s.stageType', 'st')
.leftJoin('s.reasons', 'r')
.select(['s.id', 's.description', 's.name', 'st.id', 'st.name', 'st.displayName', 'r.id', 'r.code', 'r.description'])
.where('st.name like :INFORMED', {
INFORMED: '%\\INFORMED',
})
.orWhere('st.id = :eMeliKeyword', {
eMeliKeyword: StageTypesID.DE_MELI_KEYWORD_ID,
})
.getMany();