Hi Robert,
> I do not want to use command like select sum(pen).
SUM() is probably not a good function, but I can't see why you would rule out MAX(). In SQL there is no concept of the "first record", since it's set based. If MAX(Pen), and so forth, cannot be used, the best solution would be to create a cursor and use a SCAN loop. Skip through the table and copy field values only if the field for this month in the cursor is still empty. Something like:
SELECT Table1
SCAN
SELECT Cursor
LOCATE FOR Month=Table1.Month
IF NOT FOUND()
INSERT INTO Cursor (Month) VALUES (Table.Month)
ENDIF
IF NOT EMPTY(Table.Pen) and EMPTY(Cursor.Pen)
REPLACE NEXT 1 Pen WITH Table1.Pen
ENDIF
ENDSCAN
--
Christof