开发者

How to use select result with like in MySQL

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜