I need some MySQL code that uses a select output in 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."')%')
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
精彩评论