SELECT * FROM "plotMetadata" LEFT JOIN ( SELECT "*party_code" AS "PrimOwnerID" , event_participant_name AS "PrimOwnerID_name" FROM party_code_party_ ) AS "PrimOwnerID" USING ("PrimOwnerID") LEFT JOIN ( SELECT "*party_code" AS plot_administrator , event_participant_name AS plot_administrator_name FROM party_code_party_ ) AS plot_administrator USING (plot_administrator) LEFT JOIN "lookup_MethodCode" USING ("MethodCode") ; ALTER TABLE :table ADD PRIMARY KEY ("PlotID");