Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I hope someone can help me.
I have 2 tables.
The 1st. table with may sales
| Sales | ||
| Customer | Date | Amount |
| 1 | 01-ene | 100 |
| 2 | 02-abr | 100 |
| 1 | 03-jun | 100 |
| 4 | 07-ago | 100 |
| 5 | 02-oct | 100 |
| 6 | 04-mar | 100 |
| 6 | 01-jul | 100 |
Second table with sales discounts conditions
| Conditions | ||||
| Customer | From date | To date | Concept | % |
| 1 | 01-ene | 31-dic | 1 | 10 |
| 1 | 01-ene | 31-dic | 2 | 5 |
| 4 | 01-ene | 31-dic | 1 | 5 |
| 5 | 01-ene | 30-jun | 1 | 5 |
| 5 | 01-jul | 31-dic | 1 | 3 |
I want to create a third table with the values resulting from their combination
Like this
| New Table | Dics. Table | ||||
| Customer | Date | Amount | Concept | % | Disc. Amount |
| 1 | 01-ene | 100 | 1 | 10 | 10 |
| 1 | 01-ene | 100 | 2 | 5 | 5 |
| 2 | 02-abr | 100 | - | - | - |
| 1 | 03-jun | 100 | 1 | 10 | 10 |
| 1 | 03-jun | 100 | 2 | 5 | 5 |
| 4 | 07-ago | 100 | 1 | 5 | 5 |
| 5 | 02-oct | 100 | 1 | 3 | 3 |
| 6 | 04-mar | 100 | - | - | - |
| 6 | 01-jul | 100 | - | - | - |
Thank's in avdance
Hi,
Would you mind explaining this logic a little bit?
Thanks
Of course
I try to generate a new data table.
Applying the conditions are in Table No. 2, "conditions"
Every time that the condition is fulfilled, you must generate a new line in the new table.
I understand that I must use the function for next in the script