This is probably a simple answer, but I've been working on this problem, for the past couple days, and it's starting to drive me batty
I have a database with a many to many relationship
------------- --------------------- ------------------- |Images | |user2img | |User | ------------- --------------------- ------------------- |imgID | |id | |UserID | |imgURL | |imgID | |UserName | |imgAv | |UserID | |UserEmail | ------------- --------------------- -------------------
The user2img table indicates which image the user is allowed to view.
I'm trying to determine a SQL query that will list every image (once without repeating) and tell me if the specified user has rights to see that image or not.
So an output like,
(WHERE UserID = '1')
---------------------------- |imgID | imgURL | access | ---------------------------- |1 | xxx | Yes | |2 | yyy | No | |3 | qqq | Yes | |4 | rrr | Yes | |5 | www | No | |6 | sss | Yes | etc... ----------------------------
Thanks,