I'm having an issue where TotalShippedQTY is being multiplied by the number of lines associated with one order. The duplication is coming from 3 different fields, EventCode, ExceptionCode, and EventDateTime. Each order can have different EventCodes, ExceptionCodes, and EventDateTimes. I need to someone show all of them, but not duplicate the TotalShippedQty.
I tried using this case statement, but it didn't work.
CASE WHEN COUNT(DetailsTable.exception_code) >1
END AS TtlShippedQTY