在mysql里执行select 1 from (select count(*),concat(floor(rand(0)*2),(select table_name from information_schema.tables where table_schema='mysql' limit 0,1))a from information_schema.tables group by a)b;这句话,为什么会出错,错误信息是:ERROR 1062 (23000): Duplicate entry '1columns_priv' for key 1,到网上查了下Duplicate entry,貌似是主键重复还是什么的,但还是不太懂,有人能解释下吗?先谢谢了。
解决方案 »
- auto_increment 到上限了, 该怎么处理
- 请问网上的那些cms是不是免费的?
- 双cpu服务器上mysqld-nt进程cpu占用率始终无法超过25%
- MySQL 授權實例
- 请教关于内嵌SQL与 C语言
- 在linux 下把一个表的某个字段改类型,怎么改阿?alter table cruit add qq varchar(50);
- Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- mySQL数据库使用出错?在没有插网线的情况下,能不能使用MySQL数据库
- 谁能帮看一下这个性能该如何提高?感激不尽~
- sql 问题
- mysql 刚入门,为什么远程主机连不上呢?
- 求高手帮看看一个查询语句该怎么写
我的mysql是5.0.51b-community-nt-log版本的
我看了下,没有什么问题啊。我重新安装的mysql执行这个语句也会出错的
SQL的关键错在最后一个from information_schema.tables, 它会枚举所有的行。要以尝试下边这个:
select 1 from
(
select count(*), (concat(floor(rand(0)*2),
( select table_name from information_schema.tables where table_schema='mysql' limit 0,1)
) ) as a
from (select 0) c group by a
) b
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)