Hello,
I have two tables with different structure. Basically I wanted to compare values in these two tables where one table returns a single row for 'QUANTITY BREAK'. and other table returns multiple rows for QUANTITY BREAK.
Table A:
PART_NO
QTY_BRK1
QTY_BRK2
QTY_BRK3
QTY_BRK4
PROMO_BRK1
PROMO_BRK2
PROMO_BRK3
PROMO_BRK4
LIST_PRICE_BRK1
LIST_PRICE_BRK2
LIST_PRICE_BRK3
LIST_PRICE_BRK4
Sample Record:
PART_NO | QTY_BRK1 | QTY_BRK2 | QTY_BRK3 | QTY_BRK4 | PROMO_BRK1 | PROMO_BRK2 | PROMO_BRK3 | PROMO_BRK4 | LIST_PRICE_BRK1 | LIST_PRICE_BRK2 | LIST_PRICE_BRK3 | LIST_PRICE_BRK4 |
100 | 9000 | 99000 | 999000 | 99999999000 | 160 | 160 | 160 | 160 | 2000 | 2000 | 2000 | 2000 |
Table B:
PART_NO
QUANTITY
PRICE
Sample Record:
PART_NO | QUANTITY | PRICE |
100 | 1 | 0.016 |
100 | 10 | 0.016 |
100 | 25 | 0.024 |
100 | 100 | 0.016 |
100 | 1000 | 0.016 |
I want to find all the PART_NO's where there is a discrepancy in the Table 1 QTY BREAKS and Table 2 QUANTITY values.
In table A, QTY_BRK values are considered as follows:
QTY_BRK1 = 9000 i.e. 1-9
QTY_BRK2 = 99000 i.e. 10-99
QTY_BRK3 = 999000 i.e. 100-999
QTY_BRK4 = 99999999000 i.e. 1000-100000000
So you can see the discrepancy in above example. Table A gives 4 quantity breaks, but table B gives 5 quantity breaks for the same PART_NO. (an extra qty break of 10-25 is present)
This way I need help in writing a query which will give me all the PART_NOs which are having discrepancy in both tables.
Thanks.