Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 1
    For big tables this is probably the fastest for searching non-indexed columns. Commented Jan 16, 2014 at 15:15
  • 2
    Is it possible to also assign that @lastSN := EL.SN, @lastValue := EL.Value without actually returning it in the results? (I know you don't have to use it) Commented Oct 28, 2015 at 13:20
  • 6
    @Yeti, no, if you don't want to see those columns in your FINAL result, just wrap this query up one more level and pull out only the columns you WANT (thus without the at-place-holder columns). Commented Oct 28, 2015 at 14:32
  • Nice one! Order by is very important then but it can make the query slow. It is still much faster than doing sub query for each row. Commented Mar 3, 2017 at 13:41
  • For me this only worked correctly if I changed lastSN := 0 to lastSN := null, otherwise they if would always be true. Is there any explanation for this behavior? It doesn't make much sense to me Commented Aug 24, 2017 at 10:59