[Bast-commits] r4586 - SQL-Abstract/1.x/branches/cleanup

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Wed Jul 16 19:56:05 BST 2008


Author: matthewt
Date: 2008-07-16 19:56:05 +0100 (Wed, 16 Jul 2008)
New Revision: 4586

Modified:
   SQL-Abstract/1.x/branches/cleanup/e.pl
Log:
more examples

Modified: SQL-Abstract/1.x/branches/cleanup/e.pl
===================================================================
--- SQL-Abstract/1.x/branches/cleanup/e.pl	2008-07-16 18:42:28 UTC (rev 4585)
+++ SQL-Abstract/1.x/branches/cleanup/e.pl	2008-07-16 18:56:05 UTC (rev 4586)
@@ -92,3 +92,35 @@
             }
         ]
 );
+
+warn dump(
+  ORDER_BY { $_->aggregates->total }
+    SELECT { $_->users->name, $_->aggregates->total }
+      JOIN { $_->users->id == $_->aggregates->recipient_id }
+        [ users => expr { $_->users  } ],
+        [ aggregates =>
+            expr {
+                SELECT { $_->recipient_id, [ total => sum($_->commission) ] }
+                 WHERE { sum($_->commission) > 500 }
+              GROUP_BY { $_->recipient_id }
+                 WHERE { $_->entry_date > '2007-01-01' }
+                  expr { $_->commissions }
+            }
+        ]
+);
+
+warn dump(
+  ORDER_BY { $_->aggregates->total }
+    SELECT { $_->users->name, $_->aggregates->total }
+     WHERE { $_->aggregates->total > 500 }
+      JOIN { $_->users->id == $_->aggregates->recipient_id }
+        [ users => expr { $_->users  } ],
+        [ aggregates =>
+            expr {
+                SELECT { $_->recipient_id, [ total => sum($_->commission) ] }
+              GROUP_BY { $_->recipient_id }
+                 WHERE { $_->entry_date > '2007-01-01' }
+                  expr { $_->commissions }
+            }
+        ]
+);




More information about the Bast-commits mailing list