日期:2014-05-18  浏览次数:20366 次

sql 模糊查询问题
select * from test where a.id='1' and like '%'+'中'+'%';


想实现功能是 
通过id 以及 职位名 模糊查询出 所有职位的信息。 mysql 语句

------解决方案--------------------
SQL code
select * from test where a.id='1' and 职位名 like '%中%';

------解决方案--------------------
再注意下id的字段类型。
------解决方案--------------------
SQL code
select * from test where a.id='1' and like '%中%';

------解决方案--------------------
SQL code

--为了找出以“b”开头的名字:
mysql> SELECT * FROM pet WHERE name LIKE "b%";
--为了找出以“fy”结尾的名字:
mysql> SELECT * FROM pet WHERE name LIKE "%fy";
--为了找出包含一个“w”的名字:
mysql> SELECT * FROM pet WHERE name LIKE "%w%";