There is something wrong with the line in your last version of users_advertisements. For clarity I put one condition per line
users_advertisements = db((db.auth_user.id==db.user_tags.user_id) & (db.user_tags.tag_id==db.tag.id) & (db.advertisement.id == db.advertisement_tags.advertisement_id) & (db.tag.id == db.advertisement_tags.tag_id)).select() So the last operator between conditions should be & not == as it is in your statement above unless of course it is just a transciption error from your code to the message board.. Nothing happens in the sql end of the data access code to touch the database until you do a select() so that is why the error comes out only then. On Oct 9, 11:44 am, Jason Brower <encomp...@gmail.com> wrote: > I tried... > users_advertisements = db((db.auth_user.id==db.user_tags.user_id) & > (db.user_tags.tag_id==db.tag.id) & (db.advertisement.id == > db.advertisement_tags.advertisement_id) == (db.tag.id == > db.advertisement_tags.tag_id)).select()' > and it works until I use select() > In additon to these I need to get the specific logged in user id on top > of all this. > BR > Jason > > On 10/09/2010 09:25 PM, ron_m wrote: > > > The last statement is between two db(condition1& condition2) as in > > db(condition1& condition2)& db(condition3& condition4) > > > Why not make this statement and try it > > db(condition1& condition2& condition3& condition4).select() > > > Ron > > > On Oct 9, 11:09 am, Jason Brower<encomp...@gmail.com> wrote: > > >> #Get the users tags > >> users_tags = db((db.auth_user.id==db.user_tags.user_id)& > >> (db.user_tags.tag_id==db.tag.id)) > >> #Get the advertisement's tags too > >> advertisements_tags = db((db.advertisement.id == > >> db.advertisement_tags.advertisement_id)& (db.tag.id == > >> db.advertisement_tags.tag_id)) > >> #Now glue dem tegever and select them > >> users_advertisements = (advertisements_tags& users_tags).select() > > >> I am trying to get the tags that the current use and the advertisements > >> have in common. This is to do targeted advertising. auth_user is my > >> auth database. > >> How can I make it happen? Why doesn't the last one work? > >> --- > >> Best Regards, > >> Jason Brower > >