Re: [GENERAL] grouping consecutive records

2013-02-04 Thread Morus Walter
Hallo Виктор, thanks a lot for your explanation :-) You rock! > > This example corresponds to the ORDER BY user_id, sort > while you claim you need to ORDER BY sort, user_id. > right, I confused the order. > I will explain this for the ordering that matches your sample. > > You need to group y

Re: [GENERAL] grouping consecutive records

2013-02-04 Thread Виктор Егоров
2013/2/4 Morus Walter : > I'd like to merge all consecutive records (ordered by sort, user_id) > having the same value in user_id and key and keep the first/last > value of sort of the merged records (and probably some more values > from the first or last merged record). > > So the result should be

[GENERAL] grouping consecutive records

2013-02-04 Thread Morus Walter
Hallo, I have a question regarding a selection. I'd like to group and merge certain records having the same values in some columns, but only if they are contiguous with regard to some sort order. So for a table create table foo ( id int, user_id int, key varchar, s