Had some free time. I entered the data you sent to me. I tested the code that I posted above. I made one minor change to it. I used standard QUOTES on the WHERE line. ‘COMPLETED’ section. I also used standard QUOTES on the test data you sent to me to install the data in my local MySQL database system.
This gave me the following info from the query above:
SUM(W.WASTAGE_QUANTITY) | SUM(D.DURATION_DOWNTIME) | PRODUCTION_DATE | PRODUCT_LINE | SUM(P.DURATION) | SUM(P.QUANTITY) | SUM(P.NOMINAL_PRODUCTS) | |
---|---|---|---|---|---|---|---|
108 | 130 | 1399-07-14 00:00:00 | سراک | 3940 | 968000 | 606000 | |
10 | 10 | 1399-07-05 00:00:00 | نیک رز1 | 690 | 150000 | 207000 |
I do not see any duplications in the output. Therefore, I can not duplicate any problems you describe.
Did you try the code I posted?