How to use the selection result, as in MySQL

I need MySQL code that uses select output in a LIKE statement in WHERE.

I mean something like this:

SELECT id FROM (SELECT id,parent_id FROM units WHERE ptitle 
like '%(SELECT ptitle FROM units WHERE id='".$id."')%')
+3
source share
1 answer

you need to use concat

SELECT id FROM (

SELECT id,parent_id FROM units WHERE ptitle

like concat('%',(SELECT ptitle FROM units WHERE id='".$id."'), '%')

) sub_table
+3
source

Source: https://habr.com/ru/post/1771641/


All Articles