🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.bd.misc
Article #93

UNION ALL GROUP BY

#93
From: Dámaso Velázquez Álvarez
Date: Wed, 01 Feb 2006 12:28
19 lines
1602 bytes
Hola compañeros...

escribo para preguntar si es posible realizar una serie de consultas
SQL unidas por UNION ALL y al final hacer un GROUP BY que sea global a
todas las sub-consultas, en lugar de tener que hacer GROUP BY en cada
una de las sub-consultas.

algo así:

(
SELECT x, count(x) FROM tabla1
UNION ALL
SELECT x, count(x) FROM tabla2
UNION ALL
SELECT x, count(x) FROM tabla3
)
GROUP BY x

Muchas gracias.
Technical Details
Message-ID: <1138796931.428313.166110@o13g2000cwo.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 106e2f,cfe225487bc4fabe,start
X-Google-Attributes: gid106e2f,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail
From: "Dámaso Velázquez Álvarez" <dvelazquez@gmail.com>
Newsgroups: es.comp.bd.misc
Subject: UNION ALL GROUP BY
Date: 1 Feb 2006 04:28:51 -0800
Organization: http://groups.google.com
Lines: 20
Message-ID: <1138796931.428313.166110@o13g2000cwo.googlegroups.com>
NNTP-Posting-Host: 212.128.154.118
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1138796937 14021 127.0.0.1 (1 Feb 2006 12:28:57 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 1 Feb 2006 12:28:57 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 2.0.50727; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=212.128.154.118;
   posting-account=uhGIyQ0AAACqnng1OoS-WsqFFjfRs2x4