Hi,

I have this table:

Date Field1 Field2
-------------------------------------
08/01/2000 411 500000
14/02/2000 401 25000
16/02/2000 401 380000
16/02/2000 371 42000
18/02/2000 401 27000
17/03/2000 5311 250000
24/06/2000 301 9800

There are these 2 date intervals:
Interval1: 01/01/2000 - 15/02/2000
Interval2: 16/02/2000 - 31/12/2000

I want to make a SELECT statement which should generate this result:

Temp1 Sum(Field2) interval1 Sum(Field2) interval2
-----------------------------------------------------------------------
301 0 9800
371 0 42000
401 25000 407000
411 500000 0
5311 0 250000

The first column contains all distinct records from Field1.
The second column contains Sum(Field2) for each value in Temp1 which is in the first interval (Interval1).
The third column contains Sum(Field2) for each value in Temp1 which is in the second interval (Interval2).

Thank you.