Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Thursday, May 27, 2010

SQL window functions again

You can think of

window_function() over (partition by A,B,C [order by C,D,E])

as

'Within each group of records with a common A+B+C, return window_function [as if the rows were ordered by C,D,E] but don't group or sort the actual result rows in those ways'

I always mistakenly start by thinking that there is one window function result per A+B+C combination. There is not, there is one result per original query row.

In particular, the order by C,D,E here is an ordering of the original query rows within each group.

Followers

Blog Archive