The following query returns 1 row:
SELECT `coach_id` FROM `table_a` WHERE `coach_id` = 8
UNION ALL
SELECT `coach_id` FROM `table_b` WHERE `coach_id` = 8
But SELECT coach_id FROM table_b WHERE coach_id = 8 returns 2 rows.
And SELECT coach_id FROM table_a WHERE coach_id = 8 returns 1 row.
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.
Whats going on here? Query is executed in phpMyAdmin 4.5.2 interface on MariaDB 10.1.9 Server.
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.
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...
This is a phpMyAdmin bug, which is fixed in v4.5.3.0 (2015-12-23).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With