Method: SqlPostgres::Select#distinct_on

Defined in:
lib/sqlpostgres/Select.rb

#distinct_on(expression) ⇒ Object

Add “distinct on” to this statement. “distinct on” is a postgres extension.

Example: ** Example: select_distinct_on

select = Select.new
select.distinct_on('i')
select.select('integer', 'i')
select.select('integer', 'j')
select.from('foo')
p select.statement            # "select distinct on (i) i, j from 
                              # foo"

**



161
162
163
# File 'lib/sqlpostgres/Select.rb', line 161

def distinct_on(expression)
  @distinct_on << expression
end