Reason for my vote of 3
I previously voted this a 2, but upon further reflection he is right that this will do a running total...The query example is simply poorly defined in my opinion and lacks the explanation that this works well only when you have one aggregate that you want to return without condtional filters.
Reason for my vote of 2
This is a triangular join and is very resource intensive. You are also not guaranteed order of the sum operation as SQL pulls the data. This kind of query would choke a large data set.
The problem with this query is that you're assuming Field1 will always be smaller than the previous record. You should sort by some unique identifier, and say where ID < t.ID
You have to have an increasing id field johnharold.. You cannot expect t.Field1 to be a debit/credit amount field, rather t.Field1 is usually an autonumber field in increasing order..
the results is not matching with anything, i was thinking that this will show me by example in a list of invoices, the amount for the first plus the same value in first row, in second row, the total of the second invoice plus the value of the first invoice and so on: 120, 120 -> 100, 220 -> 15, 235 -> etc.
The template he has written won't do that. You'd have to use Invoice ID for that to work. Typically you'd do a self join on a customerID and t2.InvoiceID <= t1.InvoiceID to get that ordering.