GROUP BY and aggregate sequential numeric values
问题 Using PostgreSQL 9.0. Let's say I have a table containing the fields: company , profession and year . I want to return a result which contains unique companies and professions, but aggregates (into an array is fine) years based on numeric sequence: Example Table: +-----------------------------+ | company | profession | year | +---------+------------+------+ | Google | Programmer | 2000 | | Google | Sales | 2000 | | Google | Sales | 2001 | | Google | Sales | 2002 | | Google | Sales | 2004 | |