trouble figuring out joins, any gurus out there?
Posted by:
Mike M
Date: August 31, 2009 11:23AM
I am trying to do some kind of join but I'm not sure the difference and which one I should be using.
I have the following tables
todo
- todo_id
- title
(6, do yard work)
(7, do something at work)
todo_tag (links todo to tags, each task can have more than one tag)
- todo_id
- tag_id
(6, 3)
(6, 5)
(7, 4)
tag
- tag_id
- value
(3, home)
(4, work)
(5, yard)
project (all a project is is a group of tags and we list all the todos that have one of those tags)
- project_id
- project name
(1, my home projects)
(2, someone elses project)
project_tag
- project_id
- tag_id
(1, 3)
All the info I have is a project_id (1) and from that I want to get all the tags connected to the todos that have that the project tag (home). the tags I should get from the query are: 3,5
any direction would be appreciated