当前位置: 首页 > 知识库问答 >
问题:

Oracle 12c和11g的相关子查询工作方式不同

叶鸿
2023-03-14

我们有一个保存多条记录(下面是DDL和DML)的通用表:

CREATE TABLE "XXAB_ZZ_VAT_TRX_GT" 
(   "AB_INFO_V1" VARCHAR2(240 BYTE), 
    "AB_INFO_V2" VARCHAR2(240 BYTE), 
    "AB_INFO_V3" VARCHAR2(240 BYTE), 
    "AB_INFO_V4" VARCHAR2(240 BYTE), 
    "AB_INFO_V5" VARCHAR2(240 BYTE), 
    "AB_INFO_V6" VARCHAR2(1996 BYTE), 
    "AB_INFO_V7" VARCHAR2(240 BYTE), 
    "AB_INFO_V8" VARCHAR2(240 BYTE), 
    "AB_INFO_V9" VARCHAR2(1996 BYTE), 
    "AB_INFO_V10" VARCHAR2(1996 BYTE), 
    "AB_INFO_V11" VARCHAR2(150 BYTE), 
    "AB_INFO_V12" VARCHAR2(150 BYTE), 
    "AB_INFO_V13" VARCHAR2(150 BYTE), 
    "AB_INFO_V14" VARCHAR2(150 BYTE), 
    "AB_INFO_V15" VARCHAR2(1996 BYTE), 
    "AB_INFO_V16" VARCHAR2(150 BYTE), 
    "AB_INFO_V17" VARCHAR2(1996 BYTE), 
    "AB_INFO_V18" VARCHAR2(150 BYTE), 
    "AB_INFO_V19" VARCHAR2(150 BYTE), 
    "AB_INFO_V20" VARCHAR2(150 BYTE), 
    "AB_INFO_V21" VARCHAR2(150 BYTE), 
    "AB_INFO_V22" VARCHAR2(150 BYTE), 
    "AB_INFO_V23" VARCHAR2(150 BYTE), 
    "AB_INFO_V24" VARCHAR2(150 BYTE), 
    "AB_INFO_V25" VARCHAR2(150 BYTE), 
    "AB_INFO_V26" VARCHAR2(150 BYTE), 
    "AB_INFO_V27" VARCHAR2(150 BYTE), 
    "AB_INFO_V28" VARCHAR2(150 BYTE), 
    "AB_INFO_V29" VARCHAR2(150 BYTE), 
    "AB_INFO_V30" VARCHAR2(150 BYTE), 
    "AB_INFO_V31" VARCHAR2(150 BYTE), 
    "AB_INFO_V32" VARCHAR2(1996 BYTE), 
    "AB_INFO_V33" VARCHAR2(150 BYTE), 
    "AB_INFO_V34" VARCHAR2(150 BYTE), 
    "AB_INFO_V35" VARCHAR2(150 BYTE), 
    "AB_INFO_V36" VARCHAR2(150 BYTE), 
    "AB_INFO_V37" VARCHAR2(150 BYTE), 
    "AB_INFO_V38" VARCHAR2(150 BYTE), 
    "AB_INFO_V39" VARCHAR2(150 BYTE), 
    "AB_INFO_V40" VARCHAR2(150 BYTE), 
    "AB_INFO_N1" NUMBER, 
    "AB_INFO_N2" NUMBER, 
    "AB_INFO_N3" NUMBER, 
    "AB_INFO_N4" NUMBER, 
    "AB_INFO_N5" NUMBER, 
    "AB_INFO_N6" NUMBER, 
    "AB_INFO_N7" NUMBER, 
    "AB_INFO_N8" NUMBER, 
    "AB_INFO_N9" NUMBER, 
    "AB_INFO_N10" NUMBER, 
    "AB_INFO_N11" NUMBER, 
    "AB_INFO_N12" NUMBER, 
    "AB_INFO_N13" NUMBER, 
    "AB_INFO_N14" NUMBER, 
    "AB_INFO_N15" NUMBER, 
    "AB_INFO_N16" NUMBER, 
    "AB_INFO_N17" NUMBER, 
    "AB_INFO_N18" NUMBER, 
    "AB_INFO_N19" NUMBER, 
    "AB_INFO_N20" NUMBER, 
    "AB_INFO_N21" NUMBER, 
    "AB_INFO_N22" NUMBER, 
    "AB_INFO_N23" NUMBER, 
    "AB_INFO_N24" NUMBER, 
    "AB_INFO_N25" NUMBER, 
    "AB_INFO_N26" NUMBER, 
    "AB_INFO_N27" NUMBER, 
    "AB_INFO_N28" NUMBER, 
    "AB_INFO_N29" NUMBER, 
    "AB_INFO_N30" NUMBER, 
    "AB_INFO_D1" DATE, 
    "AB_INFO_D2" DATE, 
    "AB_INFO_D3" DATE, 
    "AB_INFO_D4" DATE, 
    "AB_INFO_D5" DATE, 
    "AB_INFO_D6" DATE, 
    "AB_INFO_D7" DATE, 
    "AB_INFO_D8" DATE, 
    "AB_INFO_D9" DATE, 
    "AB_INFO_D10" DATE, 
    "AB_INFO_D11" DATE, 
    "AB_INFO_D12" DATE, 
    "AB_INFO_D13" DATE, 
    "AB_INFO_D14" DATE, 
    "AB_INFO_D15" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM" ;
  

以下是记录:

SET DEFINE OFF;
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','48','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:B_MPV_PROWIZJA','tns:',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,856625,12,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','64','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:','tns:',null,null,null,'Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,900,90,857621,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','64','Business World',null,'tns:K_20','tns:K_17','643815678',' INPUT_VAT','POLAND VAT-KA',null,'643815678','tns:','tns:',null,null,null,'Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,400,44,857621,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','64','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:','tns:',null,null,null,'Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,2500,300,857621,12,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','161','Computer Service and Rentals',null,'tns:K_20','tns:K_17','brak',' INPUT_VAT','POLAND VAT-KA',null,null,'tns:EE','tns:',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','301 Summit Hill Drive    37401 Chattanooga US Hamilton  TN',null,null,'0',null,500,55,862618,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','161','Computer Service and Rentals',null,'tns:K_20','tns:K_17','brak',' INPUT_VAT','POLAND VAT-KA',null,null,'tns:IMP','tns:',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','301 Summit Hill Drive    37401 Chattanooga US Hamilton  TN',null,null,'0',null,300,33,862618,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','161','Computer Service and Rentals',null,'tns:K_20','tns:K_17','brak',' INPUT_VAT','POLAND VAT-KA',null,null,'tns:MR_T','tns:',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','301 Summit Hill Drive    37401 Chattanooga US Hamilton  TN',null,null,'0',null,200,22,862618,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','161','Computer Service and Rentals',null,'tns:K_20','tns:K_17','brak',' INPUT_VAT','POLAND VAT-KA',null,null,'tns:EE','tns:',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','301 Summit Hill Drive    37401 Chattanooga US Hamilton  TN',null,null,'0',null,0,0,862618,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','161','Computer Service and Rentals',null,'tns:K_20','tns:K_17','brak',' INPUT_VAT','POLAND VAT-KA',null,null,'tns:IMP','tns:',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','301 Summit Hill Drive    37401 Chattanooga US Hamilton  TN',null,null,'0',null,0,0,862618,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','161','Computer Service and Rentals',null,'tns:K_20','tns:K_17','brak',' INPUT_VAT','POLAND VAT-KA',null,null,'tns:MR_T','tns:',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','301 Summit Hill Drive    37401 Chattanooga US Hamilton  TN',null,null,'0',null,0,0,862618,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','141','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:TP','tns:GTU04',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,30,3,861618,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','141','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:TP','tns:GTU04',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,861618,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','142','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,30,3,861619,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','142','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,861619,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','143','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,218.34,21.84,861620,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','143','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,861620,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','162','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,100,10,862619,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','162','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,862619,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','163','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:IMP','tns:GTU01',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,100,12,862620,12,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','163','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:IMP','tns:GTU01',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,862620,12,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','165','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:IMP','tns:GTU01',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,100,12,862622,12,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','165','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:IMP','tns:GTU01',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,862622,12,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','166','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,100,10,862623,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','166','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:IMP','tns:GTU01',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,862623,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','43','Bigmart',null,'tns:K_14','tns:K_11','349173','INPUT_VAT','POLAND VAT-A',null,'349173','tns:EE','tns:',null,null,null,'Stankiewicza 390 3  50-550 Warszawa PL   PL',null,null,'0',null,1,0.1,856620,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','48','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:','tns:',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,3,0.3,856625,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','48','Business World',null,'tns:K_14','tns:K_11','643815678','INPUT_VAT','POLAND VAT-A',null,'643815678','tns:','tns:',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,856625,10,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','48','Business World',null,'tns:K_20','tns:K_17','643815678',' INPUT_VAT','POLAND VAT-KA',null,'643815678','tns:EE','tns:',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,2,0.22,856625,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','48','Business World',null,'tns:K_20','tns:K_17','643815678',' INPUT_VAT','POLAND VAT-KA',null,'643815678','tns:EE','tns:',null,'WEW','ORA_JEPL_DOCUMENT_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,0,0,856625,11,null,null,null);
Insert into XXAB_ZZ_VAT_TRX_GT (AB_INFO_V1,AB_INFO_V2,AB_INFO_V3,AB_INFO_V4,AB_INFO_V5,AB_INFO_V6,AB_INFO_V7,AB_INFO_V8,AB_INFO_V9,AB_INFO_V10,AB_INFO_V11,AB_INFO_V12,AB_INFO_V13,AB_INFO_V14,AB_INFO_V15,AB_INFO_V16,AB_INFO_V17,AB_INFO_V18,AB_INFO_V19,AB_INFO_V20,AB_INFO_V21,AB_INFO_N1,AB_INFO_N2,AB_INFO_N3,AB_INFO_N4,AB_INFO_N5,AB_INFO_N6,AB_INFO_N7) values ('AR','48','Business World',null,'tns:K_31','tns:','643815678','INPUT_VAT','POLAND VAT RS',null,'643815678','tns:B_MPV_PROWIZJA','tns:',null,'TRANSPORTATION','JE_PL_JPK_BUSINESS_TYPE','Stankiewicza 188 3  50-550 Warszawa PL   PL',null,null,'0',null,4,0.48,856625,12,null,null,null);
SELECT
       XMLAgg(Case When (Select ab_info_n26 From xxab_zz_vat_trx_gt Where ab_info_v1 = 'H' and ab_info_v27 = 'AR' ) > 0 Then
                          (SELECT XMLAGG(XMLCONCAT(XMLElement("tns:SprzedazWiersz",
                             xmlelement("tns:LpSprzedazy"      ,   rownum),
                             xmlelement("tns:KodKrajuNadaniaTIN",  substr(ar_trx.tax_reg_num, 0, 2)),
                             xmlelement("tns:NrKontrahenta"    ,   substr(ar_trx.tax_reg_num, 2)),
                             xmlelement("tns:NazwaKontrahenta" ,   ar_trx.cust_name),
                             xmlelement("tns:DowodSprzedazy"   ,   ar_trx.trx_number),
                             xmlelement("tns:DataWystawienia"  ,   TO_CHAR(ar_trx.invoice_date,'RRRR-MM-DD')),
                             Case When ar_trx.sales_date is not null Then xmlelement("tns:DataSprzedazy"    ,   TO_CHAR(ar_trx.sales_date,'RRRR-MM-DD')) END
                             -- Document Type
                            ,(select xmlagg(xmlconcat(xmlelement("tns:TypDokumentu", ab_info_v15)))
                              From   xxab_zz_vat_trx_gt
                              Where  ab_info_v1 = 'AR'
                              and   ab_info_n3 = ar_trx.trx_id
                              and   ab_info_v16 = 'ORA_JEPL_DOCUMENT_TYPE')
                             -- product category code
                            ,(SELECT xmlagg(xmlconcat(xmlelement(evalname(prd_code), 1)))
                              FROM  (select distinct 
                                            ab_info_n3  trx_id
                                     ,      ab_info_v13 prd_code
                                    from    xxab_zz_vat_trx_gt
                                    Where   ab_info_V1 = 'AR'
                                    and     ab_info_v13 <> 'tns:') d             
                              where d.trx_id  = ar_trx.trx_id
                            )
                            -- Trade Attributes
                            ,(SELECT xmlagg(xmlconcat(xmlelement(evalname(e.TRADE_ATTRIBUTE_VALUES), 1)))
                             from   (select distinct ab_info_n3 trx_id
                                        ,   DECODE(TRADE_ATTRIBUTE_VALUES, '1', 'tns:MPP', TRADE_ATTRIBUTE_VALUES) TRADE_ATTRIBUTE_VALUES
                                    from    xxab_zz_vat_trx_gt unpivot (TRADE_ATTRIBUTE_VALUES for TRADE_ATTRIBUTES in (ab_info_v12, ab_info_v20))
                                    Where   ab_info_V1 = 'AR'
                                    and     TRADE_ATTRIBUTE_VALUES not in ('tns:', 'tns:IMP', '0')
                                    order by case TRADE_ATTRIBUTE_VALUES
                                    when 'tns:SW'             THEN 1
                                    when 'tns:EE'             THEN 2
                                    when 'tns:TP'             THEN 3
                                    when 'tns:TT_WNT'         then 4
                                    when 'tns:TT_D'           THEN 5
                                    when 'tns:MR_T'           THEN 6
                                    when 'tns:MR_UZ'          THEN 7
                                    when 'tns:I_42'           THEN 8
                                    when 'tns:I_63'           THEN 9
                                    when 'tns:B_SPV'          THEN 10
                                    when 'tns:B_SPV_DOSTAWA'  THEN 11
                                    when 'tns:B_MPV_PROWIZJA' THEN 12
                                    when 'tns:MPP'            THEN 13
                                    ELSE 14 END) e
                             where  e.trx_id = ar_trx.trx_id)
                            ,(select    xmlagg(xmlconcat(xmlelement(evalname(fnd_box.box),ROUND(sum(nvl(ar_details.amount, 0)),2))))
                              from  (Select ab_info_n3 trx_id
                                        ,   ab_info_v5 box
                                        ,   ab_info_n1 amount
                                    From    xxab_zz_vat_trx_gt
                                    Where   ab_info_V1 = 'AR'
                                    and     ab_info_v5 <> 'tns:'
                                    and     ab_info_n3 = ar_trx.trx_id -- ERROR HERE
                                    UNION ALL
                                    Select  ab_info_n3 trx_id
                                        ,   ab_info_v6      box
                                        ,   ab_info_n2 amount
                                    From    xxab_zz_vat_trx_gt
                                    Where   ab_info_V1 = 'AR'
                                    and      ab_info_v6 <> 'tns:'
                                    and     ab_info_n3 = ar_trx.trx_id -- ERROR HERE
                                    ) ar_details
                                ,   (SELECT 'tns:K_'||(LEVEL + 9) box
                                    FROM dual
                                    CONNECT BY LEVEL <= 27) fnd_box     
                              where fnd_box.box = ar_details.box (+)
                              group by fnd_box.box)
                            )))
                             From ( Select distinct ab_info_n3  trx_id
                                                  , ab_info_v2  trx_number
                                                  , ab_info_d1  sales_date
                                                  , ab_info_d3  invoice_date
                                                  , ab_info_v3  cust_name
                                                  , ab_info_v17 cust_addr
                                                  , ab_info_v7  tax_reg_num
                                     From xxab_zz_vat_trx_gt
                                     Where ab_info_v1 = 'AR'
                                     Order by 3,4
                                  ) ar_trx                                              
                            ) End)
FROM DUAL;
   

Oracle Database 11g Enterprise Edition版本11.2.0.4.0-生产

PL/SQL版本11.2.0.4.0-生产“Core 11.2.0.4.0生产”

12C:

共有1个答案

吕征
2023-03-14

我能够通过SQL专家Chris Saxon提供的一个解决方案来解决这个问题,该解决方案使用withwithCTE。我以前使用它作为主驱动表,但事实证明,它应该位于如下所示的相关查询中:

with ar_kbox_details as (
  select ab_info_n3  trx_id,
         ab_info_v5  box,
         ab_info_n1  amount
  from xxab_zz_vat_trx_gt
  where ab_info_v1 = 'AR'
  and ab_info_v5 <> 'tns:'
  union all
  select ab_info_n3  trx_id,
         ab_info_v6  box,
         ab_info_n2  amount
  from xxab_zz_vat_trx_gt
  where ab_info_v1 = 'AR'
  and ab_info_v6 <> 'tns:'
)
SELECT XMLAGG(XMLCONCAT(XMLElement
("tns:SprzedazWiersz",
    xmlelement("tns:LpSprzedazy"      ,   rownum),
    xmlelement("tns:KodKrajuNadaniaTIN",  substr(ar_trx.tax_reg_num, 0, 2)),
    xmlelement("tns:NrKontrahenta"    ,   substr(ar_trx.tax_reg_num, 2)),
    xmlelement("tns:NazwaKontrahenta" ,   ar_trx.cust_name),
    xmlelement("tns:DowodSprzedazy"   ,   ar_trx.trx_number),
    xmlelement("tns:DataWystawienia"  ,   TO_CHAR(ar_trx.invoice_date,'RRRR-MM-DD')),
    Case When ar_trx.sales_date is not null Then xmlelement("tns:DataSprzedazy"    ,   TO_CHAR(ar_trx.sales_date,'RRRR-MM-DD')) END
    -- Document Type
    ,(select distinct xmlagg(xmlconcat(xmlelement("tns:TypDokumentu", ab_info_v15)))
    From   xxab_zz_vat_trx_gt
    Where  ab_info_v1 = 'AR'
    and ab_info_n3 = ar_trx.trx_id
    and ab_info_v16 = 'ORA_JEPL_DOCUMENT_TYPE')
    -- product category code
    ,(select distinct xmlagg(xmlconcat(xmlelement(evalname(ab_info_v13), 1)))
    from    xxab_zz_vat_trx_gt
    Where ab_info_V1 = 'AR'
    and ab_info_v13 <> 'tns:'
    and ab_info_n3  = ar_trx.trx_id)
    -- Trade Attributes
    ,(select distinct xmlagg(xmlconcat(xmlelement(evalname(DECODE(TRADE_ATTRIBUTE_VALUES, '1', 'tns:MPP', TRADE_ATTRIBUTE_VALUES)), 1))
    order by 
    case TRADE_ATTRIBUTE_VALUES
    when 'tns:SW'           THEN 1
    when 'tns:EE'           THEN 2
    when 'tns:TP'           THEN 3
    when 'tns:TT_WNT'           then 4
    when 'tns:TT_D'         THEN 5
    when 'tns:MR_T'         THEN 6
    when 'tns:MR_UZ'            THEN 7
    when 'tns:I_42'             THEN 8
    when 'tns:I_63'             THEN 9
    when 'tns:B_SPV'            THEN 10
    when 'tns:B_SPV_DOSTAWA'  THEN 11
    when 'tns:B_MPV_PROWIZJA' THEN 12
    when 'tns:MPP'          THEN 13
    ELSE 14 END)
    from     xxab_zz_vat_trx_gt unpivot (TRADE_ATTRIBUTE_VALUES for TRADE_ATTRIBUTES in (ab_info_v12, ab_info_v20))
    Where  ab_info_V1 = 'AR'
    and  TRADE_ATTRIBUTE_VALUES not in ('tns:', 'tns:IMP', '0')
    and  ab_info_n3 = ar_trx.trx_id
    )
    --KBoxes
    ,(select xmlagg(xmlconcat(xmlelement(evalname(fnd_box.box),ROUND(sum(nvl(akd.amount, 0)),2))))
    from    ar_kbox_details akd
        ,   (SELECT 'tns:K_'||(LEVEL + 9) box
            FROM dual
            CONNECT BY LEVEL <= 27) fnd_box     
    where fnd_box.box = akd.box (+)
    and   ar_trx.trx_id = akd.trx_id (+)
    group by fnd_box.box)
    )))
From ( Select distinct 
        ab_info_n3  trx_id
    ,   ab_info_v2  trx_number
    ,   ab_info_d1  sales_date
    ,   ab_info_d3  invoice_date
    ,   ab_info_v3  cust_name
    ,   ab_info_v17 cust_addr
    ,   ab_info_v7  tax_reg_num
From xxab_zz_vat_trx_gt
Where ab_info_v1 = 'AR'
Order by 3,4) ar_trx                                                
 类似资料:
  • 问题内容: 即使它有性能问题,我是否也可以知道相关子查询的用途? 问题答案: 好吧,首先它没有性能问题。就是这样,鉴于硬件和数据库结构的性能限制,它将尽可能地执行。 至于它的作用,它只是表达特定逻辑条件的一种方式。

  • 问题内容: 我有两个表:表A和表B 表A和表B都有列。 表A和表B都有列。 表A的一列也称为。 检查条件: 如果表A“键” =恒定,则从表A检索RowId。 从中获取这些行ID,并检查这些行的字段是否>具有相同rowId的表B的> ModifiedAT字段。 Table没有重复的RowId,而Table具有。 我自己尝试的方法: 注意:另外,令我感到惊讶的是,如果我将硬编码值替换为“ 1”,它会起

  • 问题内容: 我很好奇为何应该比更快地执行。 当比尔·卡尔文提出一个要点时,我正在回答一个问题。当您使用它时,它使用相关子查询(依赖子查询),而IN()仅使用子查询。 解释显示,并且两者都使用了一个依赖子查询,并且都只使用了一个子查询..所以我很好奇关联子查询如何比子查询更快? 我以前使用过EXISTS,它的执行速度比IN快,这就是我感到困惑的原因。 这是带有说明的SQLFIDDLE 一些问题 在上

  • 本文向大家介绍SQL语句中‘相关子查询’与‘非相关子查询’有什么区别?相关面试题,主要包含被问及SQL语句中‘相关子查询’与‘非相关子查询’有什么区别?时的应答技巧和注意事项,需要的朋友参考一下 (1)非相关子查询是独立于外部查询的子查询,子查询总共执行一次,执行完毕后将值传递给外部查询。 (2)相关子查询的执行依赖于外部查询的数据,外部查询执行一行,子查询就执行一次。 因此非相关子查询比相关子查

  • 我试图在我的工作表中创建一个依赖的下拉列表,在Col A中,它将允许您选择区域列表(例如。美洲、非洲、亚洲)等,然后在Col B中显示在Col A中选择的该地区国家的列表。 我尝试使用=间接和=索引/匹配公式,但它们对我超过1000行的工作表不起作用。 我的工作簿中有11个选项卡,但是我只想将数据从“国家”选项卡拉到“主呼叫表”选项卡进行验证。所有其他选项卡都是从主工作表中删除的。 在countr

  • 我正在使用ApacheLucene5.0。0并在使用QueryParser时遇到问题。我试图创建一个查询,但得到一个ParseException。 以下是我的代码: 这是我得到的例外: 如果有帮助,我已经包含了以下jar文件: lucene-analyzers-common-5.0.0.jar lucene-core-5.0.0.jar lucene-queries-5.0.0.jar lucen