phpMyAdmin对UNION ALL查询做什么? [英] What is phpMyAdmin doing to my UNION ALL query?
问题描述
以下查询返回1行:
SELECT `coach_id` FROM `table_a` WHERE `coach_id` = 8
UNION ALL
SELECT `coach_id` FROM `table_b` WHERE `coach_id` = 8
但是SELECT coach_id FROM table_b WHERE coach_id = 8
返回2行.
SELECT coach_id FROM table_a WHERE coach_id = 8
返回1行.
我正在使用UNION ALL
来避免DISTINCT
过滤,因为我实际上只是对总行数感兴趣.仍然看起来像常规UNION
又称为UNION DISTINCT
.
I'm using UNION ALL
to avoid the DISTINCT
filtering, because I'm actually just interested in the total number of rows. Still it seems to behave like regular UNION
a.k.a UNION DISTINCT
.
这是怎么回事?在MariaDB 10.1.9
服务器上的phpMyAdmin 4.5.2
界面中执行查询.
Whats going on here? Query is executed in phpMyAdmin 4.5.2
interface on MariaDB 10.1.9
Server.
我刚刚发现mysql命令行客户端的行为与预期的一样.因此,故障必须在我的nginx 1.8.0
,PHP 5.6.16
mysqli
和phpmyadmin
堆栈中的某个位置.
I just discovered that the mysql command line client behaves like expected. So the failure has to be somewhere within my stack of nginx 1.8.0
, PHP 5.6.16
mysqli
and phpmyadmin
.
当我从php脚本(使用mysqli)运行查询时,它也正确返回3行.我想除了phpMyAdmin之外,什么都不会引起这种现象.到目前为止,感谢您的帮助,对于这个问题引起误解,我们深表歉意.我不知道...
When I run the query from a php script (using mysqli) it also correctly returns 3 rows. I guess that leaves nothing but phpMyAdmin to cause this phenomenon. Thanks for the help so far and sorry that the question has been misleading. I didn't know better...
推荐答案
这是phpMyAdmin错误,已在v4.5.3.0(2015-12-23)中修复.
This is a phpMyAdmin bug, which is fixed in v4.5.3.0 (2015-12-23).
这篇关于phpMyAdmin对UNION ALL查询做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!