On 2 June 2012 16:36, Annet <anneve...@googlemail.com> wrote: > I have the following where close in a query: > > WHERE nodeid=283 and ((dayid=6 and starttime>'11:00:00')or(dayid>6)); > > In Postgresql this query outputs the right data. > > I translated this query into the following code in a function: > > rows=db((db.Timetable.nodeID==session.id > )&(((db.Timetable.dayID==6)&(db.Timetable.startTime>'11:00:00'))or(db.Timetable.dayID>6))).select() > > In web2py this code results in an empty rows object. What's the correct > syntax for this query? > > Are you sure session.id == 283 in this case?
Hint: Do a db._lastsql after your second query and compare the generated SQL to your original SQL. Also: WHERE nodeid = 283 and dayid >= 6 and starttime > '11:00:00' should give you the same result and the qauery is a bit shorter. Regards. Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)