Full threadSQL2219·Writing the query is the easy part. Ensuring you have the correct data under all scenarios is the hard part.View on HN