Subject Sub Queries
Author stdreamergr
Does Firebird 2.1 support sub queries?
If not how would you write the following.

Assume that we have a single table

CREATE TABLE TEST1 (
ID INTEGER NOT NULL,
CUSTCODE INTEGER NOT NULL,
INTDATE DATE NOT NULL,
INTVOLUME BIGINT NOT NULL,
INTVALUE NUMERIC(18,4) NOT NULL,
PRIMARY KEY (ID, CUSTCODE)
);

I want to run a query that will bring the following results

1) sum all volumes from a period easy enough

Select CUSTCODE, Sum(VOLUME) From Test1
WHERE INDATE >= '2007-01-01' AND INTDATE <='2007-03-30'
GROUP BY CUSTCODE;
2) Return the sum of volumes for an other period or from the start up
to but not including the '2007-01-01'.
something like

SELECT T1.CUSTCODE, SUM(T1.VOLUME),
(SELECT SUM(T2.VOLUME) FROM TEST1
WHERE T2.INTDATE < '2007-01-01'
AND T2.CUSTCODE = T1.CUSTCODE)
From TEST1 T1
WHERE T1.INTDATE >= '2007-01-01' AND T1.INTDATE <='2007-03-30'
GROUP BY CUSTCODE;
How would you do something like this in firebird?

Regards
Yannis.