Skip to content
Advertisement

Tag: sum

SQL query grouping by range

Hi have a table A with the following data: I’d like to have the following result: My DB is DB2/400. I have tried with ROW_NUMBER partitioning, subqueries but I can’t figure out how to solve this. Answer I understand this as a gaps-and-island problem, where you want to group together adjacent rows that have the same PA. Here is an

Advertisement