I'm no SQL expert but I think you are applying MAX to the results not to Cause. What I mean is that for ID 3 the first row (3 0 13) the result is 14 and for second row (3 1 13) result is -1. The MAX...