Bug #11470 SELECT with UNION
| Submitted: | 20 Jun 2005 23:03 | Modified: | 21 Jun 2005 0:21 |
|---|---|---|---|
| Reporter: | Joerg Michel | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 4.0.24 and 4.0.19 | OS: | Linux (Linux) |
| Assigned to: | CPU Architecture: | Any |
[20 Jun 2005 23:03]
Joerg Michel
[21 Jun 2005 0:21]
MySQL Verification Team
mysql> create table a (a int);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into a values (1), (2);
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql>
mysql> create table b (b int);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into b values (1), (2), (3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql>
mysql> create table c (c int);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into c values (1), (2), (3), (4);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql>
mysql> create table d (d int);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into d values (1), (2), (3), (4);
Query OK, 4 rows affected (0.01 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql>
mysql> select count(a) from a UNION select count(b) from b UNION
-> select count(c) from c UNION select count(d) from d\G
*************************** 1. row ***************************
count(a): 2
*************************** 2. row ***************************
count(a): 3
*************************** 3. row ***************************
count(a): 4
3 rows in set (0.01 sec)
mysql> select count(a) from a UNION ALL select count(b) from b UNION all
-> select count(c) from c UNION all select count(d) from d\G
*************************** 1. row ***************************
count(a): 2
*************************** 2. row ***************************
count(a): 3
*************************** 3. row ***************************
count(a): 4
*************************** 4. row ***************************
count(a): 4
4 rows in set (0.00 sec)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.