[web2py] Re: Help with query from multiple tables and groupby

2014-01-02 Thread 黄祥
just a suggestion, why not redefine your table models simpler? e.g. db.define_table('products', Field('name'), Field('description'), Field('selling_price', 'decimal(14,6)'), Field('promotion_price', 'decimal(14,6)'), Field('image_thumb', 'upload'), Field('image_ori', 'upload') ) best regards, sti

[web2py] Re: Help with query from multiple tables and groupby

2014-01-02 Thread Francisco
Thanks a lot Niphlod. I will modify and code to match that. Thanks again. El jueves, 2 de enero de 2014 15:26:27 UTC-6, Niphlod escribió: > > Given your expected resultset, first and foremost the price_list table is > "out of the picture". > > That's because you want just all the fields from pro

[web2py] Re: Help with query from multiple tables and groupby

2014-01-02 Thread Niphlod
Given your expected resultset, first and foremost the price_list table is "out of the picture". That's because you want just all the fields from products (id, name, description), "attach" the price from product_prices (but you NEED to choose what price (default or discount), else you'd have mul

[web2py] Re: Help with query from multiple tables and groupby

2014-01-02 Thread Francisco
Thanks Niphlod (By the way I thought I have answered but can't find my answer so if I duplicate the entry sorry) I had never worked with PostgreSQL nor any other compliant engine. I have the "bad habits" of MySQL and SQLite. So I was expecting the same behavoir. Below is the sample data, thank

[web2py] Re: Help with query from multiple tables and groupby

2014-01-01 Thread Niphlod
this example lacks "consistency", and engines that are forgiving about SQL standards such as mysql and sqlite just make everything worse. Grouping in sql means what it means in english: you take a "universe" of n records and you'd like represent it in groups . Grouping doesn't "change" the "univ

[web2py] Re: Help with query with count not showing values for zero

2013-07-02 Thread Francisco
I ended up doing two querys. Never got the left (with the count working) If some one has a better alternative I would like to know it. Thanks guys. log_count=db.auth_event.id.count() usrs = db((db.auth_event.user_id==db.auth_user.id)&(db.auth_event.time_stampdatetime_end)&(db.auth_event.descrip

[web2py] Re: Help with query

2013-03-05 Thread Massimo Di Pierro
Do not use to and from in field names. You will get into trouble. On Tuesday, 5 March 2013 11:30:50 UTC-6, Pepe Araya wrote: > > Hi! > > In words what i need is to get a set from this query: select the > 'persons.email' and 'persons.id' from table 'persons' *that are not in*table ' > invitations

Re: [web2py] Re: Help with query

2013-03-05 Thread Pepe Araya
Hi Derek and Anthony, that's make the trick!! Thank you both!! *Pepe Araya* Diseñador / Designer On Tue, Mar 5, 2013 at 4:18 PM, Derek wrote: > You can negate a part of a query by using a tilde (~). > > > On Tuesday, March 5, 2013 10:30:50 AM UTC-7, Pepe Araya wrote: >> >> Hi! >> >> In word

[web2py] Re: Help with query

2013-03-05 Thread Derek
You can negate a part of a query by using a tilde (~). On Tuesday, March 5, 2013 10:30:50 AM UTC-7, Pepe Araya wrote: > > Hi! > > In words what i need is to get a set from this query: select the > 'persons.email' and 'persons.id' from table 'persons' *that are not in*table ' > invitations.to' >

[web2py] Re: Help with query

2013-03-05 Thread Anthony
Check out .belongs() -- http://web2py.com/books/default/chapter/29/06#belongs. Anthony On Tuesday, March 5, 2013 12:30:50 PM UTC-5, Pepe Araya wrote: > > Hi! > > In words what i need is to get a set from this query: select the > 'persons.email' and 'persons.id' from table 'persons' *that are no