Hi guys, please could somebody help me?

from my tables:

db.define_table('phone_line',
            Field('tel_plan',db.tel_plan),
            Field('phone_number',length=30),
            signature, format='%(phone_number)s'
            )

db.define_table('simcard',
            Field('serial',length=100, label='Serial', notnull=True, unique=
True),
            Field('phone_line', db.phone_line, unique=True),
            Field('contract_date', 'date'),
            signature, format='%(serial)s'
            )


I'm getting the dropdown select, but I need filter phone_line's that was 
assigned to existing simcards, then I have this requires:

db.simcard.phone_line.requires = IS_IN_DB(query,db.phone_line.id, 
'%(phone_number)s')

and the only query that I have working now to show the available 
line_phone's is in two SQL versions, but I have problems to translate it to 
a DAL version:

query1 ="""SELECT *
        FROM db_base.phone_line p
        WHERE NOT EXISTS(SELECT s.id
                         FROM db_base.simcard s
                         WHERE s.phone_line = p.id)"""

 
query1 = """SELECT *
        FROM db_base.phone_line p
             LEFT OUTER JOIN db_base.simcard s ON s.phone_line = p.id
        WHERE s.phone_line IS NULL"""


How can I get it?

Thanks and Greetings.
Christian.

-- 

--- 
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/groups/opt_out.


Reply via email to