伙计们,我对这一点感到有点难过,并想知道你们是否可以帮助我。我有一个像这样的表DDL。
CREATE TABLE "BISAMPLE"."G_LEDGER"
( "FUND" VARCHAR2(6 BYTE),
"ORG" VARCHAR2(6 BYTE),
"ACCT" VARCHAR2(6 BYTE),
"FY" NUMBER,
"FP" VARCHAR2(3 BYTE),
"BUDGET" NUMBER(17,2),
"YTD" NUMBER(17,2),
"ENCB" NUMBER(17,2),
"PROG" VARCHAR2(6 BYTE)
)
然后在此表中,我有一些财务数据,如下所示 表插入:
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'03',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'03',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'03',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'04',15000,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'04',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'04',97410,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'05',15000,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'05',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'05',97410,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'06',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'06',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'06',119264,7329.97,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'07',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'07',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'07',119264,17772.95,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'08',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'08',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'08',119264,57304.11,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'09',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'09',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'09',127514,69020.23,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'10',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'10',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'10',127514,81768.35,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'11',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'11',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'11',127514,91685.63,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',6,'12',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',6,'12',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',6,'12',127514,97656.09,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'00',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'00',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'00',0,0,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'01',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'01',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'01',127514,110820.64,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'02',20000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'02',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'02',127514,117380.28,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'03',40000,11019.9,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'03',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'03',288247,126847.56,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'04',40000,16103.98,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'04',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'04',288247,140405.86,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'05',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'05',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'05',288247,158602.13,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'06',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'06',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'06',288247,171656.04,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'07',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'07',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'07',288247,188242.41,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'08',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'08',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'08',288247,214201.42,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'09',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'09',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'09',288247,224688.09,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'10',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'10',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'10',288247,232076.97,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'11',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'11',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'11',288247,242507.33,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','2010',7,'12',40000,17209.37,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','3017',7,'12',0,680,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',7,'12',288247,253002.16,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'00',1054464.33,976361.88,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'01',1047449.31,1002201.54,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'02',1047449.31,997478.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'03',1047449.31,997478.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'04',1047449.31,998023.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'05',1047449.31,998023.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'06',1047449.31,998023.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'07',1047449.31,998023.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'08',1047449.31,998023.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'09',1047449.31,998023.18,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'10',1047449.31,985049.76,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'11',1047449.31,985049.76,0,'121');
Insert into G_LEDGER (FUND,ORG,ACCT,FY,FP,BUDGET,YTD,ENCB,PROG) values ('202118','3662','7001',15,'12',1047449.31,985049.76,0,'121');
如果你运行一个简单的select语句,你将得到一个如下所示的结果集。
202118 3662 2010 121 6 3 0 0 0
202118 3662 3017 121 6 3 0 0 0
202118 3662 7001 121 6 3 0 0 0
202118 3662 2010 121 6 4 15000 0 0
202118 3662 3017 121 6 4 0 0 0
202118 3662 7001 121 6 4 97410 0 0
202118 3662 2010 121 6 5 15000 0 0
202118 3662 3017 121 6 5 0 0 0
202118 3662 7001 121 6 5 97410 0 0
202118 3662 2010 121 6 6 20000 11019.9 0
202118 3662 3017 121 6 6 0 0 0
202118 3662 7001 121 6 6 119264 7329.97 0
202118 3662 2010 121 6 7 20000 11019.9 0
202118 3662 3017 121 6 7 0 0 0
202118 3662 7001 121 6 7 119264 17772.95 0
202118 3662 2010 121 6 8 20000 11019.9 0
202118 3662 3017 121 6 8 0 0 0
202118 3662 7001 121 6 8 119264 57304.11 0
202118 3662 2010 121 6 9 20000 11019.9 0
202118 3662 3017 121 6 9 0 0 0
202118 3662 7001 121 6 9 127514 69020.23 0
202118 3662 2010 121 6 10 20000 11019.9 0
202118 3662 3017 121 6 10 0 0 0
202118 3662 7001 121 6 10 127514 81768.35 0
202118 3662 2010 121 6 11 20000 11019.9 0
202118 3662 3017 121 6 11 0 680 0
202118 3662 7001 121 6 11 127514 91685.63 0
202118 3662 2010 121 6 12 20000 11019.9 0
202118 3662 3017 121 6 12 0 680 0
202118 3662 7001 121 6 12 127514 97656.09 0
202118 3662 2010 121 7 0 0 0 0
202118 3662 3017 121 7 0 0 0 0
202118 3662 7001 121 7 0 0 0 0
202118 3662 2010 121 7 1 20000 11019.9 0
202118 3662 3017 121 7 1 0 680 0
202118 3662 7001 121 7 1 127514 110820.6 0
202118 3662 2010 121 7 2 20000 11019.9 0
202118 3662 3017 121 7 2 0 680 0
202118 3662 7001 121 7 2 127514 117380.3 0
202118 3662 2010 121 7 3 40000 11019.9 0
202118 3662 3017 121 7 3 0 680 0
202118 3662 7001 121 7 3 288247 126847.6 0
202118 3662 2010 121 7 4 40000 16103.98 0
202118 3662 3017 121 7 4 0 680 0
202118 3662 7001 121 7 4 288247 140405.9 0
202118 3662 2010 121 7 5 40000 17209.37 0
202118 3662 3017 121 7 5 0 680 0
202118 3662 7001 121 7 5 288247 158602.1 0
202118 3662 2010 121 7 6 40000 17209.37 0
202118 3662 3017 121 7 6 0 680 0
202118 3662 7001 121 7 6 288247 171656 0
202118 3662 2010 121 7 7 40000 17209.37 0
202118 3662 3017 121 7 7 0 680 0
202118 3662 7001 121 7 7 288247 188242.4 0
202118 3662 2010 121 7 8 40000 17209.37 0
202118 3662 3017 121 7 8 0 680 0
202118 3662 7001 121 7 8 288247 214201.4 0
202118 3662 2010 121 7 9 40000 17209.37 0
202118 3662 3017 121 7 9 0 680 0
202118 3662 7001 121 7 9 288247 224688.1 0
202118 3662 2010 121 7 10 40000 17209.37 0
202118 3662 3017 121 7 10 0 680 0
202118 3662 7001 121 7 10 288247 232077 0
202118 3662 2010 121 7 11 40000 17209.37 0
202118 3662 3017 121 7 11 0 680 0
202118 3662 7001 121 7 11 288247 242507.3 0
202118 3662 2010 121 7 12 40000 17209.37 0
202118 3662 3017 121 7 12 0 680 0
202118 3662 7001 121 7 12 288247 253002.2 0
202118 3662 2010 121 7 13 20000 11019.9 0
202118 3662 3017 121 7 13 0 680 0
202118 3662 7001 121 7 13 127514 117380.3 0
202118 3662 2010 121 7 14 20000 11019.9 0
202118 3662 3017 121 7 14 0 680 0
202118 3662 7001 121 7 14 127514 117380.3 0
202118 3662 7001 121 15 0 1054464 976361.9 0
202118 3662 7001 121 15 1 1047449 1002202 0
202118 3662 7001 121 15 2 1047449 997478.2 0
202118 3662 7001 121 15 3 1047449 997478.2 0
202118 3662 7001 121 15 4 1047449 998023.2 0
202118 3662 7001 121 15 5 1047449 998023.2 0
202118 3662 7001 121 15 6 1047449 998023.2 0
202118 3662 7001 121 15 7 1047449 998023.2 0
202118 3662 7001 121 15 8 1047449 998023.2 0
202118 3662 7001 121 15 9 1047449 998023.2 0
202118 3662 7001 121 15 10 1047449 985049.8 0
202118 3662 7001 121 15 11 1047449 985049.8 0
202118 3662 7001 121 15 12 1047449 985049.8 0
您会注意到,对于每个ACCT,我有一个FY和FP,但是一旦我到了FY15,我就不再拥有其他两个账户2010和3017的前一个数据的数据值。我想创建一个基本上为这些帐户转发结束余额的查询。所以举个例子。截至FY 7和FP12的账户3017的期末余额对于预算为0,对于YTD为680。同样,对于2010年账户,预算结束余额为40000,年初至今为17209.37。更具体的说明,如果该帐户在当前最大" FY" (在本例中为FY 15)比我想查询的最后一次最大值" FY"对于那个基金,并显示那些留下的账户的余额。这是预期输出。
FUND ORG ACCT FY FP BUDGET YTD ENCB PROG
202118 3662 2010 6 3 0 0 0 121
202118 3662 3017 6 3 0 0 0 121
202118 3662 7001 6 3 0 0 0 121
202118 3662 2010 6 4 15000 0 0 121
202118 3662 3017 6 4 0 0 0 121
202118 3662 7001 6 4 97410 0 0 121
202118 3662 2010 6 5 15000 0 0 121
202118 3662 3017 6 5 0 0 0 121
202118 3662 7001 6 5 97410 0 0 121
202118 3662 2010 6 6 20000 11019.9 0 121
202118 3662 3017 6 6 0 0 0 121
202118 3662 7001 6 6 119264 7329.97 0 121
202118 3662 2010 6 7 20000 11019.9 0 121
202118 3662 3017 6 7 0 0 0 121
202118 3662 7001 6 7 119264 17772.95 0 121
202118 3662 2010 6 8 20000 11019.9 0 121
202118 3662 3017 6 8 0 0 0 121
202118 3662 7001 6 8 119264 57304.11 0 121
202118 3662 2010 6 9 20000 11019.9 0 121
202118 3662 3017 6 9 0 0 0 121
202118 3662 7001 6 9 127514 69020.23 0 121
202118 3662 2010 6 10 20000 11019.9 0 121
202118 3662 3017 6 10 0 0 0 121
202118 3662 7001 6 10 127514 81768.35 0 121
202118 3662 2010 6 11 20000 11019.9 0 121
202118 3662 3017 6 11 0 680 0 121
202118 3662 7001 6 11 127514 91685.63 0 121
202118 3662 2010 6 12 20000 11019.9 0 121
202118 3662 3017 6 12 0 680 0 121
202118 3662 7001 6 12 127514 97656.09 0 121
202118 3662 2010 7 0 0 0 0 121
202118 3662 3017 7 0 0 0 0 121
202118 3662 7001 7 0 0 0 0 121
202118 3662 2010 7 1 20000 11019.9 0 121
202118 3662 3017 7 1 0 680 0 121
202118 3662 7001 7 1 127514 110820.6 0 121
202118 3662 2010 7 2 20000 11019.9 0 121
202118 3662 3017 7 2 0 680 0 121
202118 3662 7001 7 2 127514 117380.3 0 121
202118 3662 2010 7 3 40000 11019.9 0 121
202118 3662 3017 7 3 0 680 0 121
202118 3662 7001 7 3 288247 126847.6 0 121
202118 3662 2010 7 4 40000 16103.98 0 121
202118 3662 3017 7 4 0 680 0 121
202118 3662 7001 7 4 288247 140405.9 0 121
202118 3662 2010 7 5 40000 17209.37 0 121
202118 3662 3017 7 5 0 680 0 121
202118 3662 7001 7 5 288247 158602.1 0 121
202118 3662 2010 7 6 40000 17209.37 0 121
202118 3662 3017 7 6 0 680 0 121
202118 3662 7001 7 6 288247 171656 0 121
202118 3662 2010 7 7 40000 17209.37 0 121
202118 3662 3017 7 7 0 680 0 121
202118 3662 7001 7 7 288247 188242.4 0 121
202118 3662 2010 7 8 40000 17209.37 0 121
202118 3662 3017 7 8 0 680 0 121
202118 3662 7001 7 8 288247 214201.4 0 121
202118 3662 2010 7 9 40000 17209.37 0 121
202118 3662 3017 7 9 0 680 0 121
202118 3662 7001 7 9 288247 224688.1 0 121
202118 3662 2010 7 10 40000 17209.37 0 121
202118 3662 3017 7 10 0 680 0 121
202118 3662 7001 7 10 288247 232077 0 121
202118 3662 2010 7 11 40000 17209.37 0 121
202118 3662 3017 7 11 0 680 0 121
202118 3662 7001 7 11 288247 242507.3 0 121
202118 3662 2010 7 12 40000 17209.37 0 121
202118 3662 3017 7 12 0 680 0 121
202118 3662 7001 7 12 288247 253002.2 0 121
202118 3662 7001 15 0 1054464 976361.9 0 121
202118 3662 7001 15 1 1047449 1002202 0 121
202118 3662 7001 15 2 1047449 997478.2 0 121
202118 3662 7001 15 3 1047449 997478.2 0 121
202118 3662 7001 15 4 1047449 998023.2 0 121
202118 3662 7001 15 5 1047449 998023.2 0 121
202118 3662 7001 15 6 1047449 998023.2 0 121
202118 3662 7001 15 7 1047449 998023.2 0 121
202118 3662 7001 15 8 1047449 998023.2 0 121
202118 3662 7001 15 9 1047449 998023.2 0 121
202118 3662 7001 15 10 1047449 985049.8 0 121
202118 3662 7001 15 11 1047449 985049.8 0 121
202118 3662 7001 15 12 1047449 985049.8 0 121
202118 3662 2010 15 0 40000 17209.37 0 121
202118 3662 2010 15 1 40000 17209.37 0 121
202118 3662 2010 15 2 40000 17209.37 0 121
202118 3662 2010 15 3 40000 17209.37 0 121
202118 3662 2010 15 4 40000 17209.37 0 121
202118 3662 2010 15 5 40000 17209.37 0 121
202118 3662 2010 15 6 40000 17209.37 0 121
202118 3662 2010 15 7 40000 17209.37 0 121
202118 3662 2010 15 8 40000 17209.37 0 121
202118 3662 2010 15 9 40000 17209.37 0 121
202118 3662 2010 15 10 40000 17209.37 0 121
202118 3662 2010 15 11 40000 17209.37 0 121
202118 3662 2010 15 12 40000 17209.37 0 121
202118 3662 3017 15 0 0 680 0 121
202118 3662 3017 15 1 0 680 0 121
202118 3662 3017 15 2 0 680 0 121
202118 3662 3017 15 3 0 680 0 121
202118 3662 3017 15 4 0 680 0 121
202118 3662 3017 15 5 0 680 0 121
202118 3662 3017 15 6 0 680 0 121
202118 3662 3017 15 7 0 680 0 121
202118 3662 3017 15 8 0 680 0 121
202118 3662 3017 15 9 0 680 0 121
202118 3662 3017 15 10 0 680 0 121
202118 3662 3017 15 11 0 680 0 121
202118 3662 3017 15 12 0 680 0 121
希望这是有道理的,我在没有plsql的情况下很难说明这一点,我想知道我是否可以在不使用PL / SQL的情况下做到这一点?
答案 0 :(得分:1)
尝试这样的事情:
<html>
<head>
<title>json loop</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
</script>
<div id="container">
<div id="div"></div>
<div id="output">nothing yet</div>
</div>
<script>
var previous = null;
var current = null;
var data;
setInterval(function() {
$.getJSON(
"https://dweet.io/get/latest/dweet/for/myesp8266",
function(json) {
data = json;
current = JSON.stringify(data);
$("div").html(data);
console.log(data);
if (previous && current && previous !== current) {
console.log('refresh');
location.reload();
}
previous = current;
});
}, 2000);
var output = document.getElementById('output');
output.innerHTML = data ;
</script>
</body>
</html>
答案 1 :(得分:1)
假设您希望将最后一个FY数据提交到最新的FY中,那些在最新的FY中没有任何账户的账户。您可以使用窗口函数找到记录,UNION与其他人一起查找记录:
SELECT
fund, org, acct,
Max_fy_overall fy, -- Project the values into latest FY
, fp ,budget, ytd, encb, prog
FROM
(SELECT g.*,
Max(fy) over (partition by acct) max_fy
Max(fy) over () max_fy_overall
FROM g_ledger g
) t
WHERE
and max_fy <> max_fy_overall
And fy = max_fy
UNION ALL
select * from g_ledger; -- And rest of the records.