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) 求一个MySql序列问题 mysql还原数据备份时是如何防止冲突的? 数据表应用索引 求my.ini的标准配置 PostgreSQL中:如何显示所有表! 高分请求MYSQL数据表海量数据存储方案 mysql下的like问题 Mysql起动后马上自动停止是什么原因? 【敢问MySQL除了免费之外,还有什么优点?况且操作起来这么麻烦!】 求一条sql语句,高分 关于调用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)