[SQL] aggregation problem: first/last/count(*)

2009-01-26 Thread Marc Mamin
Hello, I have a query to aggregate data wich is too slow :-) Here a simplified example: create table test ( time int8, --store the time as epoch a_group varchar, category varchar ) For each group, I need the first/last times and categories , the number of distinct categories

Re: [SQL] aggregation problem: first/last/count(*)

2009-01-26 Thread Volkan YAZICI
On Mon, 26 Jan 2009, Marc Mamin m.ma...@intershop.de writes: create table test ( time int8, --store the time as epoch a_group varchar, category varchar ) ... SELECT FIRST.a_group, FIRST.time as first_time, FIRST.category as first_category, LAST.time as