Re: Aggregates on empty groups.

From: --CELKO-- <jcelko212_at_earthlink.net>
Date: 1 Aug 2004 20:22:04 -0700
Message-ID: <18c7b3c2.0408011922.6e46f926_at_posting.google.com>


>> SELECT dept, SUM(sal) FROM Employees GROUP BY dept;

.. and departments that are not in emp relation: Finance 0 <<

But if Finance is not the Employees table, how does it get a group? You might build such a thing:

SELECT dept, SUM(sal) FROM Employees GROUP BY dept UNION
SELECT DISTINCT dept, {NULL | 0.00} FROM OtherDepartments;

or something with an OUTER JOIN, but this is not a simple GROUP BY. Received on Mon Aug 02 2004 - 05:22:04 CEST

Original text of this message