Re: Unique Primary Key Linked to Multiple Accounts

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Unique Primary Key Linked to Multiple Accounts
Дата
Msg-id f3234005-01aa-4a0f-9caa-c002f0e46c91@aklaver.com
обсуждение исходный текст
Ответ на Unique Primary Key Linked to Multiple Accounts  (Anthony Apollis <anthony.apollis@gmail.com>)
Ответы Re: Unique Primary Key Linked to Multiple Accounts
Список pgsql-general
On 11/12/23 23:02, Anthony Apollis wrote:
> Please advice. I brought in data from SAP and assigned unique primary 
> key to the table:
> 

> 
> I joined it with a dimension table.
> 
> Joining code
> 
> fact."IMETA_ZTRB_MP$F_ZTBR_TA_BW"ASfact
> LEFTJOINdim."IMETA_BRACS_Mapping"ASbracs_map
> ONfact."Account_Number"=bracs_map."GCoA"ANDfact."Expense_Type"=bracs_map."EXPENSE FLAG"
> 
> It is joined on the Account numbers, which appears in the table multiple 
> times. Problem is the Unique Primary Key is then mapped to these Account 
> numbers multiple times.

This is not a problem it is the nature of the table definitions and the 
query. The PK is "ZTBR_TransactionCode", but you are joining on 
fact."Account_Number"=bracs_map."GCoA"ANDfact."Expense_Type"=bracs_map."EXPENSE 
FLAG". Since you indicate that there are multiple account numbers in the 
table then it is no surprise that the "ZTBR_TransactionCode" is repeated.


> Please advice.
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Is "WITH RECURSIVE" limited to the first position of CTEs by design?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Unique Primary Key Linked to Multiple Accounts