[web2py] Re: how to NOT IN with DAL?

2010-02-16 Thread mdipierro
Yes. print db(db.t.day wrote: > Thanks, Massimo. Are you sure about the "[db.t.day.max()]"? > > I'll also check dal.py if I don't find it in the book. ;-) > > @Thadeus: on a Sybase ASE MAX returns one row only. See below. > > CREATE TABLE "mt_mytable" ( > id int not null, > text varchar > ) > > in

[web2py] Re: how to NOT IN with DAL?

2010-02-16 Thread baloan
Hi Tiago, you mean like this? SELECT DAY FROM T WHERE DAY < '2007-12-04' ORDER BY DAY DESC LIMITBY 1 I remember this not working on Oracle 7.3.4 (yeah it is somewhat outdated) because Oracle would sort only AFTER limiting the result set. So, as a workaround this might not work on all databases.

[web2py] Re: how to NOT IN with DAL?

2010-02-16 Thread baloan
Thanks, Massimo. Are you sure about the "[db.t.day.max()]"? I'll also check dal.py if I don't find it in the book. ;-) @Thadeus: on a Sybase ASE MAX returns one row only. See below. CREATE TABLE "mt_mytable" ( id int not null, text varchar ) insert into "tempdb"."guest"."mt_mytable" (id, text)

[web2py] Re: how to NOT IN with DAL?

2010-02-15 Thread mdipierro
print db(db.t.day wrote: > Now I'm trying to do > > SELECT MAX(DAY) FROM T WHERE DAY < '2007-12-04' > > and I fail to find an operator for "MAX" in the web2py book. Is it > supported? > > Regards, Andreas > > PS: The online book is splendid. I like it. Much easier to work with. > Now web2py is a tr

Re: [web2py] Re: how to NOT IN with DAL?

2010-02-15 Thread Thadeus Burgess
The issue here is that MAX is not a single record, it could be 5 records with the same date, it could be 5000 records with the same date. -Thadeus On Mon, Feb 15, 2010 at 5:08 PM, Tiago Almeida wrote: > Can't you sort by day and get the first? > I don't know if max exists. > Regards, > Tiago

Re: [web2py] Re: how to NOT IN with DAL?

2010-02-15 Thread Tiago Almeida
Can't you sort by day and get the first? I don't know if max exists. Regards, Tiago On Mon, Feb 15, 2010 at 10:49 PM, baloan wrote: > Now I'm trying to do > > SELECT MAX(DAY) FROM T WHERE DAY < '2007-12-04' > > and I fail to find an operator for "MAX" in the web2py book. Is it > supported? > >

[web2py] Re: how to NOT IN with DAL?

2010-02-15 Thread baloan
Now I'm trying to do SELECT MAX(DAY) FROM T WHERE DAY < '2007-12-04' and I fail to find an operator for "MAX" in the web2py book. Is it supported? Regards, Andreas PS: The online book is splendid. I like it. Much easier to work with. Now web2py is a truly "free" application. Note: In section

[web2py] Re: how to NOT IN with DAL?

2010-02-12 Thread mdipierro
db(~db.a.asof.belongs(db()._select(db.b.asof)).select(db.a.asof) On Feb 12, 3:20 pm, baloan wrote: > Hello, > > given two tables: > > >>> db.define_table('A', Field('asof'), Field('data')) > >>> db.define_table('B', Field('asof'), Field('other')) > > I'd like to to identify all rows in A having n