Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion help with aggregation & group by
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Van De Vyver  
View profile  
 More options Nov 6 2007, 5:23 am
From: "Mark Van De Vyver" <mvy...@gmail.com>
Date: Tue, 6 Nov 2007 21:23:47 +1100
Local: Tues, Nov 6 2007 5:23 am
Subject: Re: help with aggregation & group by
I'm sold, I've just seen the :table__field___alias
 syntax too :)

On Nov 6, 2007 8:40 PM, Sharon Rosner <cico...@gmail.com> wrote:

> > from   :c => Customer, :b => Bank, :a => Account
> >   select b.name
> >   where  ((c.firstname == first1) |
> >           (c.firstname == first2)), etc.

> > appeared simpler than having blocks and .AS, but no doubt there is a
> > limit to his approach I'm unaware of.

> Actually for that kind of thing you can specify your filter as a hash:

>   where(:firstname => [first1, first2])

> Notice how you can provide an array and Sequel takes care of
> constructing the filter. Also gives you nicer-looking SQL:

>   ... WHERE firstname IN ('john', 'george')

> If you need to qualify the field name you can use the special symbol
> notation:

>   where(:c__firstname => [first1, first2])

> Sequel also lets you use any comparison operator, not just ==:

>   where {:price > 100}

> You can also specify mathemtic expressions and compare against other
> fields:

>   where {:price < :avg[:price] - 100}

> Have a look at the cheat sheet:

>   http://code.google.com/p/ruby-sequel/wiki/CheatSheet

> sharon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.