Forum Discussion
LisaB
Helper III
7 years agoCombinig two tables - duplicates in keys
Hi, I have two tables, one sales invoice header and one sales credit memos, that I would like to combine into one. However, the same document number can exist in both tables meaning I will have "...
LisaB
Helper III
7 years agoHi MFelix ,
Thank you for your reply.
I have attached some example data - one tab for Sales Inv Header and one tab for Sales Cr Header. Since the two document types were using two different number series that were so much alike they "collided" in the end.
What I would like to do is to merge these two tables into one table where invoice 101010 should be one entry and credit memo 101010 should be another line. One idea I have is to put a prefix in front of the document number, i.e. INV101010 and CR101010, but that means I won't be able to use document number in another relationsships.
Table: SalesInvHeader
| Posting date | No_Header | Customer_No | Amount |
| 2019-01-02 | 101010 | 30000 | 35 000,00 |
| 2019-01-02 | 101011 | 10000 | 5 788,00 |
| 2019-01-03 | 101012 | 20000 | 9 000,00 |
| 2019-01-03 | 101013 | 20000 | 1 577,00 |
| 2019-01-04 | 101014 | 10000 | 1 533,00 |
| 2019-01-10 | 101015 | 20000 | 1 023,00 |
Table: SalesCrHeader
| Posting date | No_Header | Customer_No | Amount |
| 2019-01-01 | 101010 | 30000 | 10 000,00 |
| 2019-01-01 | 101011 | 10000 | 20 000,00 |
| 2019-01-02 | 101012 | 20000 | 15 000,00 |
Thanks.
Lisa