Given a user, select only the projects that he is interested in.
So a user table has x, y, z columns that have a value of 1 (if interested) and 0 (if not interested)
Once we get the user we need to get all the projects that have the atleast one of x, y, z value similar.
So given:
prj title | x | y | z |
__________________________________________
prj1 | 1 | 0 | 1 |
prj2 | 1 | 1 | 0 |
prj3 | 0 | 0 | 1 |
and the user table:
user id | x | y | z |
__________________________________________
user1 | 1 | 0 | 0 |
user2 | 1 | 1 | 0 |
user3 | 0 | 0 | 1 |
Need to find a query that will give me a list of projects that a given user (user1) is interested in.
Result should be (if user 1 is selected): prj1 and prj2
Result should be (if user 3 is selected): prj1 and prj3
any ideas on how this can be achieved? I am not sure where to start from.
I am not sure if this can be done in just one simple query?
Try this: