diff options
author | Jason Kurian <JaKXz@users.noreply.github.com> | 2017-02-22 18:20:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-22 18:20:06 -0500 |
commit | 1ee6710b54c013d31951ce22c74ac72377ebbbf6 (patch) | |
tree | d09851c6ba660f226dd289a6d664a44d21bee5d8 | |
parent | 668da2dfa951ea43f9b2c1171b225b10dba50a3a (diff) | |
download | rails-1ee6710b54c013d31951ce22c74ac72377ebbbf6.tar.gz rails-1ee6710b54c013d31951ce22c74ac72377ebbbf6.tar.bz2 rails-1ee6710b54c013d31951ce22c74ac72377ebbbf6.zip |
docs: add distinct to README
-rw-r--r-- | README.md | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -150,7 +150,14 @@ The `OR` operator works like this: users.where(users[:name].eq('bob').or(users[:age].lt(25))) ``` -The `AND` operator behaves similarly. +The `AND` operator behaves similarly. The exception is the `DISTINCT` operator, which is not chainable: + +``` +posts = Arel::Table.new(:posts) +posts.project(posts[:title]) +posts.distinct +posts.to_sql # => 'SELECT DISTINCT "posts"."title" FROM "posts"' +``` Aggregate functions `AVG`, `SUM`, `COUNT`, `MIN`, `MAX`, `HAVING`: |