OK, I want to do Flickr-style related tags, but this is too hard-core techie for me to pull off, I’ll need some help.

Let’s say I have a database with a table TAGS, a table OBJECTS and a table TAGS2OBJECTS. If given the ID of a TAG, how can I find a list of ID’s for related TAGS, in other words, tags that have been assigned to similar objects? Is it just a query or should I add some table or field to the tables?

One Response to “”

  1. James Spahr Says:

    Sounds like you want to establish a many to many relationship.

    SELECT objects.name FROM tags, objects, tags2objects WHERE objects.id = tags2objects.object_id AND tags2objects.tags_id AND tags.name = ‘foo’;

Leave a Reply