select 语句查找的问题??急救啊!!! select 语句后面的那个引号是多余的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你那个是利用web页面来传参数的吧,如果是的话,你先把你得到的,要传给数据库执行的SQL语句打印出来,看看是不是:select * from book where title like %qq%;这样的语句。mysql> use test;Database changedmysql> create table test(id int not null auto_increment primary key, -> title varchar(20) not null);Query OK, 0 rows affected (0.14 sec)mysql> insert into test(title) values('qq'),('123'),('2'),('1'),('3'),('c++');Query OK, 6 rows affected (0.08 sec)Records: 6 Duplicates: 0 Warnings: 0mysql> select * from test;+----+-------+| id | title |+----+-------+| 1 | qq || 2 | 123 || 3 | 2 || 4 | 1 || 5 | 3 || 6 | c++ |+----+-------+6 rows in set (0.00 sec)mysql> prepare stmt from 'select * from test where title like ?';Query OK, 0 rows affected (0.00 sec)Statement preparedmysql> set @a='%1%';Query OK, 0 rows affected (0.00 sec)mysql> execute stmt using @a;+----+-------+| id | title |+----+-------+| 2 | 123 || 4 | 1 |+----+-------+2 rows in set (0.00 sec)mysql> set @b='%qq%';Query OK, 0 rows affected (0.00 sec)mysql> execute stmt using @b;+----+-------+| id | title |+----+-------+| 1 | qq |+----+-------+1 row in set (0.00 sec) DISTINCT 的 请教 mysql与tomcat连接中遇到的问题 求一条SQL语句! 请大家帮忙。。。。。。。。。。 求教~~~~~~~~~~~~~~~(100分相送) mysql innodb 外键的原理? MySQL新版Sysbench测试每秒达50万查询 随机抽取并更新 mysql查询问题 请求大神,多谢! 关于调用mysql存储过程的问题 一个java 程序连接不了mysql问题
mysql> use test;
Database changed
mysql> create table test(id int not null auto_increment primary key,
-> title varchar(20) not null);
Query OK, 0 rows affected (0.14 sec)mysql> insert into test(title) values('qq'),('123'),('2'),('1'),('3'),('c++');
Query OK, 6 rows affected (0.08 sec)
Records: 6 Duplicates: 0 Warnings: 0mysql> select * from test;
+----+-------+
| id | title |
+----+-------+
| 1 | qq |
| 2 | 123 |
| 3 | 2 |
| 4 | 1 |
| 5 | 3 |
| 6 | c++ |
+----+-------+
6 rows in set (0.00 sec)
mysql> prepare stmt from 'select * from test where title like ?';
Query OK, 0 rows affected (0.00 sec)
Statement preparedmysql> set @a='%1%';
Query OK, 0 rows affected (0.00 sec)mysql> execute stmt using @a;
+----+-------+
| id | title |
+----+-------+
| 2 | 123 |
| 4 | 1 |
+----+-------+
2 rows in set (0.00 sec)mysql> set @b='%qq%';
Query OK, 0 rows affected (0.00 sec)mysql> execute stmt using @b;
+----+-------+
| id | title |
+----+-------+
| 1 | qq |
+----+-------+
1 row in set (0.00 sec)