有一个表,名字是main,表内容如下:mysql>select*frommain;+------+----------+|ID|username|+------+----------+|0|user0||1|user1||2|user2|+------+----------+执行命令返回:mys... 有一个表,名字是main,表内容如下:
mysql> select * from main;
+------+----------+
| ID | username |
+------+----------+
| 0 | user0 |
| 1 | user1 |
| 2 | user2 |
+------+----------+
执行命令返回:
mysql> select username from main where username='user0' || (select 1 from dual where (select username from main where username='user0')='user0');
+----------+
| username |
+----------+
| user0 |
| user1 |
| user2 |
+----------+
为什么会有这个结果?我从来没有在我的语句里面涉及user1和user2,顺便说一下,单独执行执行第二句select 1 from dual where (select username from main where username='user0')='user0'结果如下:
+---+
| 1 |
+---+
| 1 |
+---+ 展开
鸿蒙传说
相关分类