🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: es.comp.bd.misc
2 messages
2 total messages Started by Dámaso Velázquez Álvarez Wed, 01 Feb 2006 12:28
UNION ALL GROUP BY
#93
Author: 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.
Re: UNION ALL GROUP BY
#95
Author: -Nacho-
Date: Mon, 06 Feb 2006 12:04
13 lines
1418 bytes
Yo lo haría mediante una sentencia como
SELECT * FROM
(SELECT * FROM x
UNION ALL
SELECT * FROM y
UNION ALL
SELECT * FROM z
)
GROUP BY campo

Prueba a ver
-
Nacho
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads