This commit is contained in:
Alexey Milovidov 2021-04-04 15:07:52 +03:00
parent 729214c845
commit 9383fec50b
2 changed files with 8 additions and 8 deletions

View File

@ -1,16 +1,16 @@
3 8
13 28
23 48
33 68
13 28
3 8
13 28
23 48
33 68
13 28
3 8
13 28
23 48
33 68
13 28
3 8
13 28
23 48
33 68
13 28

View File

@ -15,10 +15,10 @@ INSERT INTO union1 VALUES (11,12,13,14,15);
INSERT INTO union2 VALUES (21,22,23,24,25);
INSERT INTO union3 VALUES (31,32,33,34,35);
select b, sum(c) from ( select a, b, sum(c) as c from union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union2 where b>1 group by a, b ) as a group by b;
select b, sum(c) from ( select a, b, sum(c) as c from union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union2 where b>1 group by a, b ) as a group by b;
select b, sum(c) from ( select a, b, sum(c) as c from union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union1 where b>1 group by a, b ) as a group by b;
select b, sum(c) from ( select a, b, sum(c) as c from union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union3 where b>1 group by a, b ) as a group by b;
select b, sum(c) from ( select a, b, sum(c) as c from union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union2 where b>1 group by a, b order by a, b) as a group by b order by b;
select b, sum(c) from ( select a, b, sum(c) as c from union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union2 where b>1 group by a, b order by a, b) as a group by b order by b;
select b, sum(c) from ( select a, b, sum(c) as c from union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union1 where b>1 group by a, b order by a, b) as a group by b order by b;
select b, sum(c) from ( select a, b, sum(c) as c from union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union3 where b>1 group by a, b order by a, b) as a group by b order by b;
DROP TABLE union1;
DROP TABLE union2;