Select within another select using the LIKE operator

Asked

Viewed 108 times

0

GOAL

I need to make a select inside another select using the LIKE operator converting the value of the other select to LOWER, but it is returning error

QUERY

select *
from tbl_client
where "NODE" like ('%'select lower("HOST") from ahc_msystems where "NODE" = 'UTE:pdo-sc03zdbdam030507:NT''%')

OUTPUT

ERROR: syntax error at or near "select" Line: 1

  • It seems to me that your command is wrongly built. You are assuming that what is in parentheses is a string formed by concatenating the '%' with the result of SELECT but did not build the command properly. Does the "NODE" field exist in the two tables used? Maybe the position(substring in string) function can help you.

  • There is, I’ll test...

1 answer

0

SOLUTION:

LIKE '%' || (SELECT ...) || '%'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.