Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.0.13
-
None
-
CentOS release 6.5 (Final)
Description
I get the wrong result when I join 2 tables and use group by at the same time.
How I can fix this problem?
MariaDB [workspace]> DROP TABLE IF EXISTS t1;
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [workspace]> DROP TABLE IF EXISTS t2;
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [workspace]> CREATE TABLE t1(id CHAR(16), PRIMARY KEY(id));
|
Query OK, 0 rows affected (0.02 sec)
|
|
MariaDB [workspace]> INSERT INTO t1 VALUES ('78622');
|
Query OK, 1 row affected (0.00 sec)
|
|
MariaDB [workspace]> INSERT INTO t1 VALUES ('786220');
|
Query OK, 1 row affected (0.00 sec)
|
|
MariaDB [workspace]> CREATE TABLE t2(id CHAR(16), VAR INT DEFAULT NULL, PRIMARY KEY(id));
|
Query OK, 0 rows affected (0.04 sec)
|
|
MariaDB [workspace]> INSERT INTO t2 VALUES ('78622',1);
|
Query OK, 1 row affected (0.00 sec)
|
MariaDB [workspace]> SELECT id, VAR FROM t1 LEFT JOIN t2 USING(id) GROUP BY id;
|
+--------+------+
|
| id | VAR |
|
+--------+------+
|
| 78622 | NULL |
|
| 786220 | NULL |
|
+--------+------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [workspace]> SELECT id, VAR FROM t1 LEFT JOIN t2 USING(id);
|
+--------+------+
|
| id | VAR |
|
+--------+------+
|
| 78622 | 1 |
|
| 786220 | NULL |
|
+--------+------+
|
2 rows in set (0.00 sec)
|
Attachments
Issue Links
- duplicates
-
MDEV-5719 Wrong result with GROUP BY and LEFT OUTER JOIN
- Closed