Massimo, thanks for the quick reply, seems to work :)
Regards
 czamb

On 22 Dez., 02:21, mdipierro <[email protected]> wrote:
> If you have joins, I would do this:
>
> movies_with_activeTag=db(db.movies.id.belongs(db(db.link.tagID==id_of_activeTag)._select(db.link.movieID,groupby=db.link.movieID,orderby=db.link.movieID))).select()
>
> On Dec 21, 7:00 pm, czamb <[email protected]> wrote:
>
> > This should be an easy one, but I can't figure it out. I am using the
> > tagging implementation from plugin_wiki: Two tables (tag and link)
> > store the info about tags on records in a third table (e.g. "movies").
> > db.tag has Fields id and name=str
> > db.link has fields id, tagID=int and movieID=int
>
> > Now if a user clicks on a tag in the tag-cloud, what is a good query
> > to find all movies with that tag?
> > Can I do that with standard queries and .select() or do I need to use
> > executesql?
>
> > movies_with_activeTag=db((db.link.tagID==id_of_activeTag)&(db.movies.id==db.link.movieID)).select()
>
> > was something I came up with (I have about zero experience with the
> > query syntax) but it gives strange recursion errors:
> > ...
> > File "c:\\web2py\gluon\dal.py", line 3456, in __allocate
> >     raise RuntimeError, "Using a recursive select but encountered a
> > broken reference"
> > RuntimeError: Using a recursive select but encountered a broken
> > reference
>
> > If I need the SQL execution, how can I convert its output to a rows
> > object?
> > sqlite is the database
> > Thanks in advance any help is welcome.
> > Regards
> >   czamb
>
>

Reply via email to