The problem is that there is no SQL query that allows you to return something like this. Once you get
returns items in a way that gives me result like this: 1. message text 01 (tags: tag01) 2. message text 01 (tags: tag03) 3. message text 02 (tags: tag03) 4. message text 02 (tags: tag05) 5. message text 02 (tags: tag06) you have to group them into message + list of tags programmatically On Aug 4, 4:25 am, David Marko <dma...@tiscali.cz> wrote: > How to define DAL query to retrieve items and theirs tags? I have > following tables: > > 'message' <--> 'tagging'(maty-to-many between message and tag tables) > <---> 'tag' > > How to retrieve list of all mesages and their assotiated tags so I can > list messages in a view like this: > 1. message text 01 (tags: tag01, tag03) > 2. message text 02 (tags: tag03, tag05, tag06) > etc. > > I looked to web2py book to 'One to Many Relation' examples but they > returns items in a way that gives me result like this: > 1. message text 01 (tags: tag01) > 2. message text 01 (tags: tag03) > 3. message text 02 (tags: tag03) > 4. message text 02 (tags: tag05) > 5. message text 02 (tags: tag06) > > There must be something I missed. > David