SELECT,其中行值包含字符串MySQL [英] SELECT where row value contains string MySQL
本文介绍了SELECT,其中行值包含字符串MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在MySQL数据库中选择一行,其中某列的值包含"XcodeDev"?
How can I select a row in my MySQL DB where the value of a column contains 'XcodeDev' for example?
我尝试过:
SELECT * FROM Accounts WHERE Username LIKE '$query'
但是,如果Username值与查询完全相同,它只会选择一行.
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?
推荐答案
Use the %
wildcard, which matches any number of characters.
SELECT * FROM Accounts WHERE Username LIKE '%query%'
这篇关于SELECT,其中行值包含字符串MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文