** test.prg
CREATE CURSOR tt (xm C(10), lrsj D)
INSERT INTO tt VALUES ("张三", CTOD("2017-1-1"))
INSERT INTO tt VALUES ("张三", CTOD("2017-1-2"))
INSERT INTO tt VALUES ("李四", CTOD("2017-1-2"))
INSERT INTO tt VALUES ("王五", CTOD("2017-1-3"))
INSERT INTO tt VALUES ("张三", CTOD("2017-1-4"))
INSERT INTO tt VALUES ("王五", CTOD("2017-1-5"))
INDEX on lrsj TAG lrsj DESCENDING
CREATE CURSOR tj (xm C(10), lrsj D)
INDEX on xm TAG xm
SELECT tt
SET RELATION TO xm INTO "tj"
SCAN
IF !FOUND("tj")
INSERT INTO tj VALUES (tt.xm, tt.lrsj)
ENDIF
ENDSCAN
SET RELATION TO
SELECT tj
SET ORDER TO
BROWSE
[此贴子已经被作者于2018-2-15 15:00编辑过]