[web2py] Re: SQL Query Help Using DAL

2011-06-24 Thread Massimo Di Pierro
I am guessing, I have not tried it mfrom = db.messages.with_alias('mfrom') mto = db.messages.with_alias('mfrom') db(db.auth_user).select(db.auth.user.first_name, db.auth_user.last_name, mfrom.id.count(), mto.id.count(),

Re: [web2py] Re: SQL Query Help Using DAL

2011-06-24 Thread David J.
Thanks I will try now. On 6/24/11 3:27 PM, Massimo Di Pierro wrote: I am guessing, I have not tried it mfrom = db.messages.with_alias('mfrom') mto = db.messages.with_alias('mfrom') db(db.auth_user).select(db.auth.user.first_name, db.auth_user.last_name, mfrom.id.count(),

Re: [web2py] Re: SQL Query Help Using DAL

2011-06-24 Thread David J.
Massimo; Thanks, this sort of works; The numbers seem off but this gives a good starting point; One other thing I would like to extend the table to include on other field 'mtype' which would be a value of 'text' or 'media', If I wanted to extend the query to use the previous query and

[web2py] Re: SQL Query Help Using DAL

2011-06-24 Thread Massimo Di Pierro
You can replace mfrom.on(mfrom.from==db.auth_user.id) with mfrom.on((mfrom.from==db.auth_user.id)(mfrom.type=='text')) and the same with the mto. On Jun 24, 3:06 pm, David J. da...@styleflare.com wrote: Massimo; Thanks, this sort of works; The numbers seem off but this gives a good

Re: [web2py] Re: SQL Query Help Using DAL

2011-06-24 Thread David J.
Got it thanks I think I tried but perhaps I did not use the right syntax I think I tried (mfrom.from==db.auth_user.id mfrom.type=='text') But I think it has to be logically separate (mfrom.from==db.auth_user.id)(mfrom.type=='text') On 6/24/11 4:28 PM, Massimo Di Pierro wrote: You can