summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorSimon Holywell <[email protected]>2012-11-12 11:20:46 +0000
committerSimon Holywell <[email protected]>2012-11-12 11:20:46 +0000
commit22e24b17b4888e62fc7ee59e3516f1d063d342b1 (patch)
tree3331dd77cbd0e027c85c2c89c07bf2faa13f09e9 /README.markdown
parent8896487378dfee87883e2fa4a260812796bb6848 (diff)
Issue #16 Aggregate function support
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown11
1 files changed, 11 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index a2b2ac7..f303457 100644
--- a/README.markdown
+++ b/README.markdown
@@ -34,6 +34,7 @@ Changelog
* Allow an associative array to be passed to `configure` method [[jordanlev](http://github.com/jordanlev)]
* Patch to allow empty Paris models to be saved ([[j4mie/paris](http://github.com/j4mie/paris)]) issue #58
* Add `select_many` and `select_many_expr` - closing issues #49 and #69
+* Add support for `MIN`, `AVG`, `MAX` and `SUM` - closes issue #16
#### 1.1.1 - release 2011-01-30
@@ -343,6 +344,16 @@ The `join` methods also take an optional third parameter, which is an `alias` fo
->join('person', array('p1.parent', '=', 'p2.id'), 'p2')
->find_many();
+#### Aggregate functions ####
+
+There is support for `MIN`, `AVG`, `MAX` and `SUM` in addition to `COUNT` (documented earlier).
+
+To return a minimum value of column, call the `min()` method.
+
+ $min = ORM::for_table('person')->min('height');
+
+The other functions (`AVG`, `MAX` and `SUM`) work in exactly the same manner. Supply a column name to perform the aggregate function on and it will return an integer.
+
#### Raw queries ####
If you need to perform more complex queries, you can completely specify the query to execute by using the `raw_query` method. This method takes a string and optionally an array of parameters. The string can contain placeholders, either in question mark or named placeholder syntax, which will be used to bind the parameters to the query.