[MDEV-9437] COUNT DISTINCE with GROUP BY with ORDER BY broken Created: 2016-01-20 Updated: 2016-02-17 Resolved: 2016-02-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 10.0.22 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | M. Braun | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | need_feedback | ||
| Description |
|
I'm running two queries on a view. Both group by the same set of columns (a,b,c) and count the values of a fourth column d. When using COUNT(d), the query returns 13 rows. When using COUNT(Dinstinct d), the queries returns >30 rows, most of them have count(d)=1. Obviously, the latter output is wrong. Using distinct works when skipping the ORDER BY clause or using the same column ordering in the order by clause as with the group by clause. Works: SELECT a,b,c , count( d ) FROM someView Works: SELECT a,b,c , count(distinct d ) FROM someView Broken: SELECT a,b,c , count(distinct d ) FROM someView I'm using MariaDB 10.0.22-MariaDB-0+deb8u1 - (Debian). This used to work with MySQL 5 and maybe MariaDB 5. |
| Comments |
| Comment by Elena Stepanova [ 2016-01-20 ] |
|
If possible, please provide the schema/data dump. |
| Comment by Elena Stepanova [ 2016-02-17 ] |
|
Please comment to re-open if you have more information on the issue. |