> CREATE TABLE t1(a INTEGER, b INTEGER, c INTEGER);
> INSERT INTO t1 VALUES(1,2,1);
> INSERT INTO t1 VALUES(NULL,2,2);
> INSERT INTO t1 VALUES(1,NULL,4);
> INSERT INTO t1 VALUES(NULL,NULL,8);
> INSERT INTO t1 SELECT * FROM t1;
> SELECT a, b, sum(c) FROM t1 GROUP BY a, b ORDER BY 3;
Microsoft SQL Server 2000 (only difference is I used a temp table):
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
(4 row(s) affected)
a b
----------- ----------- -----------
1 2 2
NULL 2 4
1 NULL 8
NULL NULL 16
(4 row(s) affected)