hi,
What would be a good way of creating a lookup table from a query? For
example say I had a three column table which I wanted to transform into a
hash of hashes where the first level keys would be the values of the first
column, the second level keys would be the values of the second column and
the values would be the sum of all third column values for the combinations
of the values of the first and second column. Or more concretely, say I had
the table:
a | b | c
-----------
z | x | 1
z | x | 2
z | y | 1
s | x | 1
The expected result would be {'z' => {'x' => 3, 'y' => 1}, 's' => {'x' =>
1}}
I know I can use to_hash with multiple columns but that doesn't allow for
an easy lookup.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.