method

columns_for_distinct

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveRecord::ConnectionAdapters::SchemaStatements
columns_for_distinct(columns, orders) public

Given a set of columns and an ORDER BY clause, returns the columns for a SELECT DISTINCT. PostgreSQL, MySQL, and Oracle override this for custom DISTINCT syntax - they require the order columns appear in the SELECT.

columns_for_distinct("posts.id", ["posts.created_at desc"])
Show source
Register or log in to add new notes.