.contains() should do that...

Could you post model and controller, the issue is maybe somewhere else in
your code.

Richard


On Thu, Nov 21, 2013 at 9:59 AM, Kevin Bethke <kevin.bet...@gmail.com>wrote:

> each book has one author but I want to select all Books which have Author
> id=7
>
>
> On Thu, Nov 21, 2013 at 3:30 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Each book that refer to an Author will only has one Author what the
>> problem there?
>>
>> You may want to aggregate the book for one author in the same cell of a
>> table that is another thing that you could address in different way... Most
>> probably iter over all the book for an author and build manually a table
>> with web2py helpers...
>>
>> Richard
>>
>>
>>
>>
>> On Thu, Nov 21, 2013 at 9:20 AM, BlueShadow <kevin.bet...@gmail.com>wrote:
>>
>>> Hi
>>> I got two tables Books and Authors
>>> Book(Name,List:Author,...)
>>> each book has at least one author
>>> now I want to have a list of all the books one Author has written.
>>> So I came up with this line of code:
>>> l=db(db.Books.Author.contains(Author.id)).select(db.Books.ALL, orderby=
>>> db:Books.Name)
>>> which works but it only gives me one Book per Author.
>>> I got no clue why this happens I know that I have several Authors which
>>> have more than one book.
>>>
>>>  --
>>> 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.
>>>
>>
>>  --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/bnP-qe7Nwwk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> 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.
>

-- 
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.

Reply via email to