db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id
)).select(db.pc.ALL)

Richard



On Fri, Sep 4, 2015 at 3:35 PM, P T <pthimmapu...@gmail.com> wrote:

>
> Hello Forum,
>
> Please help me in getting the equivalent DAL query for the following SQL
> query. I intend to pass this on to SQLFORM.grid
>
> Select * from db.pc where db.pc.id not in (select unique
> db.assigned.computer from db.assigned)
>
> Web2Py Version
> 2.9.12-stable+timestamp.2015.02.15.23.04.25
> (Running on Rocket 1.2.6, Python 2.7.9)
>
> db.define_table('staff',
>                 Field('name', 'string', unique=True),
>                format='%(name)s')
>
> db.define_table('pc',
>                 Field('csi', 'string', unique=True),
>                format='%(csi)s')
>
> db.define_table('assigned',
>                 Field('staff', db.staff),
>                 Field('computer', db.pc))
>
> Thanks,
> PT
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to