On 2016/02/18 4:59 PM, Igor Tandetnik wrote: > On 2/18/2016 4:55 AM, R Smith wrote: >> First of, your intended results require a fundamentally wrong assumption >> about Sets. (SQL is essentially operating on SETs and sets have no >> order). >> You should really have another column, like a primary key ID that notes >> the position of each line > > Looks like L is precisely such an ID. The OP is looking for runs of > identical (I, V) pairs when the table is scanned in order by (I, L) > (or, in other words, for each value of I, runs of V's in order by L). > > If that's the case, then //...
That was my first impression too Igor, but look again, I goes to 2 while L is still lingering on 7... the very next line sees L going to 1 while I is 2 to produce a moment when the order is not at all as sensible and breaks any formal ordering that can be seen as a run. L will again get to 7... will it definitely be after I changes? Perhaps it was late and the OP was tired, but the example is not sensible as given without another column.