Method: Sequel::Dataset#window
- Defined in:
- lib/sequel/dataset/query.rb
#window(name, opts) ⇒ Object
Return a clone of the dataset with an addition named window that can be referenced in window functions. See Sequel::SQL::Window for a list of options that can be passed in. Example:
DB[:items].window(:w, partition: :c1, order: :c2)
# SELECT * FROM items WINDOW w AS (PARTITION BY c1 ORDER BY c2)
1135 1136 1137 |
# File 'lib/sequel/dataset/query.rb', line 1135 def window(name, opts) clone(:window=>((@opts[:window]||EMPTY_ARRAY) + [[name, SQL::Window.new(opts)].freeze]).freeze) end |