> > where do you put he query db.auth_user.branch_adress? > db.auth_user.branch.address not db.auth_user.branch_adress
db.table.reference_table_field_from_table.field_of_reference_table it depend where i want to receive the query db.auth_user.branch.address result, e.g. if i want the result in models, i put it on models, if in controllers in put it on controllers, if in views i put it on views. > > I want the user to add company, not to choose from avaliable companies, > but the data is inserted into organization table > sorry, i'm just gave you an example, not to force you to follow mine, in example above is just to describe : 1. the order when i define the database table : e.g. the auth user table have refer to table branch, so that i must create / define branch table before i define auth user table 2. i'm show normalization in database to minimalize redundant data : e.g. i'm just define 1 field that refer to 1 table, even i want some information from that table, let say, i want to know where the auth_user is active, so like example above, i can query it using db.auth_user.branch.address. perhaps you can follow anthony reference to the book. you can imagine it that client table is auth_user table and address table is organization table. 1 more thing, if the client table field is added, for example add the new field gender, i think the address table only refer to client table once. best regards, stifan -- 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/groups/opt_out.