Permalink
Browse files

added additional join example

  • Loading branch information...
1 parent 400a917 commit 804d899bab2772ed8162fe20985ac816f6048b87 Michael Lang committed with jeremyevans Sep 11, 2009
Showing with 5 additions and 2 deletions.
  1. +5 −2 doc/cheat_sheet.rdoc
@@ -121,9 +121,12 @@ You can use arithmetic operators and specify SQL functions:
== Joins
- DB[:items].left_outer_join(:categories, :id => :category_id).sql #=>
- "SELECT * FROM items LEFT OUTER JOIN categories ON categories.id = items.category_id"
+ DB[:items].left_outer_join(:categories, :id => :category_id).sql
+ #=> "SELECT * FROM items LEFT OUTER JOIN categories ON categories.id = items.category_id"
+ DB[:items].join(:categories, :id => :category_id).join(:groups, :id => :items__group_id)
+ #=> "SELECT * FROM items INNER JOIN categories ON categories.id = items.category_id INNER JOIN groups ON groups.id = items.group_id"
+
== Summarizing
dataset.count #=> record count

0 comments on commit 804d899

Please sign in to comment.