I'm sorry for the inconvenience, I made a mistake in my field for my term
"valid" criterion was antagonistic to the selection I was trying to do...

[?]

Richard

It should wrote :

db((db['table1'].verified == None) & (db['table1'].valid == None) |
(db['table1'].verified == False) & (db['table1'].valid !=
False)).select(db['table1'].id)



On Wed, Dec 8, 2010 at 2:53 PM, Brian M <[email protected]> wrote:

> I suspect that you need some extra () in there to correctly group your
> AND and OR.
>
> Maybe try the below version
>
> db(((db['table1'].verified == None) & (db['table1'].data_grade ==
> 'grade1') &
> (db['table1'].valid != False)) | ((db['table1'].verified == False) &
> (db['table1'].data_grade == 'grade1') & (db['table1'].valid !=
> False))).select(db['table1'].id)
>
> add the following to your code to see what SQL is actually being sent
> to your database which should help you find the problem:
>    print db['_lastsql']
>
> ~Brian
>
> On Dec 8, 1:28 pm, Richard Vézina <[email protected]> wrote:
> > Hello,
> >
> > At the DB level this request return results...
> >
> > SELECT id
> > FROM table1
> > WHERE verified IS NULL and data_grade = 'grade1' and valid IS NOT FALSE
> or
> > verified IS FALSE and data_grade = 'grade1' and valid IS NOT FALSE
> >
> > In web2py with equivalent :
> >
> > db((db['table1'].verified == None) & (db['table1'].data_grade ==
> 'grade1') &
> > (db['table1'].valid != False) | (db['table1'].verified == False) &
> > (db['table1'].data_grade == 'grade1') & (db['table1'].valid !=
> > False)).select(db['table1'].id)
> >
> > Get nothing!!
> >
> > Do I have a syntaxe error or what?
> >
> > Thanks
> >
> > Richard
>

<<32F.gif>>

Reply via email to