SELECT "EDI"."EC_InventoryTransfer"."BrandName","EDI"."EC_InventoryTransfer"."DetailId" FROM "EDI"."EC_InventoryTransfer" INNER JOIN dblink('dbname=erp2','SELECT "BrandName","DetailId" FROM "EDI"."EC_InventoryTransfer"') AS Y ("BrandName" varchar(15),"DetailId" int8) ON "EDI"."EC_InventoryTransfer"."BrandName" = Y."BrandName" AND "EDI"."EC_InventoryTransfer"."DetailId"=Y."DetailId";