MySql 查询包含某个字符串的记录

Question

How can I select a row in my MySQL DB where the value of a column contains ‘XcodeDev’ for example?

I tried:

SELECT * FROM Accounts WHERE Username LIKE ‘$query’
But it only selects a row were the Username value is exactly the same to the query.

What can I do to achieve what I want?

Answer

Use the % wildcard, which matches any number of characters.

SELECT * FROM Accounts WHERE Username LIKE ‘%query%’
原文链接

Question

精确查找某属性为“23“的记录

Answer

select * from table_test where FIND_IN_SET(“23”, field_A) ;

你可能感兴趣的:(代码)