I want to find all rows form one table where one field is contained into another field. For example:
It seems simple:
SELECT * FROM MyTable WHERE name LIKE CONCAT('%', parent_names, '%')
I need 1-st and 3-rd row from this query, but the above doesn't work!
Use INSTR()
SELECT * FROM MyTable
WHERE instr(parent_names, name) > 0
交换列,
WHERE parent_names LIKE CONCAT('%', name, '%')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.