日期:2014-05-17 浏览次数:20871 次
CREATE OR REPLACE TABLE SKSJB
(
XH CHAR(15) PRIMARY KEY;
XM VARCHAR2(30);
ZC NUMBER;
XQ NUMBER;
JC1 NUMBER;
JC2 NUMBER;
ZT NUMBER;
)
INSERT INTO SKSJB values('012100349', 'Tom', 10, 3, 3, 4, 0);
INSERT INTO SKSJB values('012100349', 'Tom', 10, 4, 3, 4, 0);
INSERT INTO SKSJB values('012100349', 'Tom', 11, 5, 7, 8, 0);
INSERT INTO SKSJB values('012100349', 'Tom', 12, 6, 5, 6, 0);
INSERT INTO SKSJB values('012100349', 'Tom', 17, 6, 5, 6, 1);
INSERT INTO SKSJB values('012100350', 'Kim', 10, 3, 3, 4, 0);
INSERT INTO SKSJB values('012100350', 'Kim', 10, 4, 3, 4, 0);
INSERT INTO SKSJB values('012100350', 'Kim', 11, 5, 7, 8, 0);
INSERT INTO SKSJB values('012100350', 'Kim', 12, 6, 5, 6, 0);
INSERT INTO SKSJB values('012100350', 'Kim', 19, 6, 5, 6, 1);
INSERT INTO SKSJB values('012100351', 'James', 10, 3, 3, 4, 0);
INSERT INTO SKSJB values('012100351', 'James', 10, 4, 3, 4, 0);
INSERT INTO SKSJB values('012100351', 'James', 11, 5, 7, 8, 0);
INSERT INTO SKSJB values('012100351', 'James', 12, 6, 5, 6, 0);
INSERT INTO SKSJB values('012100352', 'Ray', 10, 3, 3, 4, 0);
INSERT INTO SKSJB values('012100352', 'Ray', 10, 4, 3, 4, 0);
INSERT INTO SKSJB values('012100352', 'Ray', 11, 5, 7, 8, 0);
INSERT INTO SKSJB values('012100352', 'Ray', 12, 6, 5, 6, 0);
select ZC, XQ, JC1, JC2, ZT,max(id) from (
select ZC, XQ, JC1, JC2, ZT,row_number() over(partition by Z