Dear All,
I have defined this model:
db.define_table('fruits_in_shop',
Field('shop_name'),
Field('species'),
Field('number','integer'))
With this kind of record inside:
fruits_in_shop.id<http://127.0.0.1:8000/welcome/appadmin/select/db?orderby=fruits_in_shop.id>
fruits_in_shop.shop_name<http://127.0.0.1:8000/welcome/appadmin/select/db?orderby=fruits_in_shop.shop_name>
fruits_in_shop.species<http://127.0.0.1:8000/welcome/appadmin/select/db?orderby=fruits_in_shop.species>
fruits_in_shop.number<http://127.0.0.1:8000/welcome/appadmin/select/db?orderby=fruits_in_shop.number>
1 <http://127.0.0.1:8000/welcome/appadmin/update/db/fruits_in_shop/1>Mark's
shopapple322<http://127.0.0.1:8000/welcome/appadmin/update/db/fruits_in_shop/2>Mark's
shoppear223<http://127.0.0.1:8000/welcome/appadmin/update/db/fruits_in_shop/3>John's
Marketbanana224<http://127.0.0.1:8000/welcome/appadmin/update/db/fruits_in_shop/4>John's
Marketapple36
I'm looking for a way to show the result as a "pivot table":
*Shop apple pear banana*
Mark's shop 32 22 0
John's* *Market 32 0 22
I often used a mysql trick to get this result (similar to this one:
http://www.artfulsoftware.com/infotree/queries.php#78), but there is a way
to get this result using DAL?
Otherwise I suppose to perform sequential queries and store the results in
a dictionary.
(fruits<-select distict fruit from table; for fruit in fruits:
column<-select * from table where fruit=fruit;)
In this case, there is a (easy) way to convert that dictionary into a
gluon.sql.Rows object?
Should I use its __init__ method?
Any help would be apprecciated :)
--