Обсуждение: Cant seem to find join problem

Поиск
Список
Период
Сортировка

Cant seem to find join problem

От
Anthony Apollis
Дата:
I am trying to join these two tables using Left Join. Only got columns for the Fact table and nothing for the dimension table(s), which I did before.
Using columns:  Entity_Secondary_Key in system."IMETA_ZTRB_MP$F_ZTBR_TA_BW" and Direct_Primary_Key in dim."IMETA_Direct_Indirect_Mapping_New"

left join -- Table: system.IMETA_ZTRB_MP$F_ZTBR_TA_BW -- DROP TABLE IF EXISTS system."IMETA_ZTRB_MP$F_ZTBR_TA_BW"; CREATE TABLE IF NOT EXISTS system."IMETA_ZTRB_MP$F_ZTBR_TA_BW" ( "Company_Code" character varying(4) COLLATE pg_catalog."default", "Posting_Period" character varying(7) COLLATE pg_catalog."default", "Fiscal_Year" character varying(4) COLLATE pg_catalog."default", "Profit_Center" character varying(255) COLLATE pg_catalog."default", "Account_Number" character varying(255) COLLATE pg_catalog."default", "Business_Process" character varying(255) COLLATE pg_catalog."default", "Cost_Center" character varying(10) COLLATE pg_catalog."default", "Internal_Order" character varying(255) COLLATE pg_catalog."default", "Trading_Partner" character varying(255) COLLATE pg_catalog."default", "Amount_in_company_code_currency" numeric(17,2), "Company_code_currency" character varying(5) COLLATE pg_catalog."default", "BRACS_FA" character varying(255) COLLATE pg_catalog."default", "Expense_Type" character varying(255) COLLATE pg_catalog."default", "BRACS_ACCT_Key" character varying(255) COLLATE pg_catalog."default", "CC_Direct" character varying(255) COLLATE pg_catalog."default", "Segment_PC" character varying(255) COLLATE pg_catalog."default", "CC_Master_FA" character varying(255) COLLATE pg_catalog."default", "RowInsertedTimestamp" date DEFAULT CURRENT_DATE, "RowUpdatedTimestamp" timestamp without time zone DEFAULT CURRENT_TIMESTAMP, "IMETA_ZTBR_BRACS_Primary_Key" integer NOT NULL DEFAULT nextval('system."IMETA_ZTBR_BRACS_Primary_Key_seq"'::regclass), "Entity_Secondary_Key" integer DEFAULT nextval('system."Entity_Secondary_Key_seq"'::regclass), CONSTRAINT "IMETA_ZTRB_MP$F_ZTBR_TA_BW_pkey" PRIMARY KEY ("IMETA_ZTBR_BRACS_Primary_Key"), CONSTRAINT "Entity_Secondary_Key_unique" UNIQUE ("Entity_Secondary_Key") ) TABLESPACE pg_default; ALTER TABLE IF EXISTS system."IMETA_ZTRB_MP$F_ZTBR_TA_BW" OWNER to ; with -- Table: dim.IMETA_Direct_Indirect_Mapping_New -- DROP TABLE IF EXISTS dim."IMETA_Direct_Indirect_Mapping_New"; CREATE TABLE IF NOT EXISTS dim."IMETA_Direct_Indirect_Mapping_New" ( "BRACS Account Description" character varying(255) COLLATE pg_catalog."default", "CLASSIFICATION" character varying(255) COLLATE pg_catalog."default", "Direct_Secondary_Key" integer NOT NULL, "Direct_Primary_Key" integer NOT NULL DEFAULT nextval('dim."IMETA_Direct_Indirect_Mapping_New_New_Direct_Primary_Key_seq"'::regclass), CONSTRAINT "IMETA_Direct_Indirect_Mapping_New_pkey" PRIMARY KEY ("Direct_Primary_Key") ) TABLESPACE pg_default; ALTER TABLE IF EXISTS dim."IMETA_Direct_Indirect_Mapping_New" OWNER to find join columns

Re: Cant seem to find join problem

От
Dan Smith
Дата:
Hello Anthony!

You may want to format your DDL/DQL and add some white space.  Presently, it's not legible without actually doing this work in my opinion.  pgFormatter or similar tools would help.

Presently, this is just one big block of statements with comments mixed in, but you are essentially asking for community code review as I see it.  So, in this spirit, I strongly urge you to improve the code legibility to help others help you.

Asking (or expecting) the community to copy code and reformat, or build tables and populate, just to try to find an issue with your left join is likely unnecessary.

Likely, there is an apparent answer.  The level of effort to quickly respond meaningfully is presently high though (at least for me).


Best regards,

Dan Smith