Dear MonetDB-users, a complete newbie to MonetDB, I can't really tell whether it is a bug, feature or I'm just getting it all wrong. A script below illustrates some weird NULL handling behaviour found in Nov2008-SP2: -- years under audit CREATE TABLE BUDGET_PERIOD (BP smallint NOT NULL); INSERT INTO BUDGET_PERIOD VALUES (1998); INSERT INTO BUDGET_PERIOD VALUES (1999); INSERT INTO BUDGET_PERIOD VALUES (2000); INSERT INTO BUDGET_PERIOD VALUES (2001); INSERT INTO BUDGET_PERIOD VALUES (2002); INSERT INTO BUDGET_PERIOD VALUES (2003); INSERT INTO BUDGET_PERIOD VALUES (2004); INSERT INTO BUDGET_PERIOD VALUES (2005); -- annual expenditure data CREATE TABLE EXPENDITURE (BP smallint NOT NULL, AMOUNT DECIMAL(15,2)); INSERT INTO EXPENDITURE VALUES (1999, 0.00); INSERT INTO EXPENDITURE VALUES (2000, 1.00); INSERT INTO EXPENDITURE VALUES (2001, 2.00); INSERT INTO EXPENDITURE VALUES (2002, 3.00); INSERT INTO EXPENDITURE VALUES (2003, 4.00); INSERT INTO EXPENDITURE VALUES (2004, NULL); -- calculate past years expenditure as of year: expected to be NULL for 1998, returns 0 SELECT A.BP, SUM( B.AMOUNT ) AS TOTAL_EXPD_ASOF FROM BUDGET_PERIOD A LEFT JOIN EXPENDITURE B ON (A.BP >= B.BP) GROUP BY A.BP ORDER BY A.BP -- same as above using CASE: returns all nulls (?!) SELECT A.BP, SUM( CASE WHEN A.BP >= B.BP THEN B.AMOUNT ELSE NULL END ) FROM BUDGET_PERIOD A, EXPENDITURE B GROUP BY A.BP go Regards, Vladimir