-
Perhaps a better way to visualise the data would be like this:
uploads
uid = 1, ufile = redapple1.jpg
uid = 2, ufile = redapple2.jpg
uid = 3, ufile = greenapple.jpg
tags
tid = 1, tname = apple
tid = 2, tname = red
tid = 3, tname = green
tags_uploads
tuid = 1, tid = 1, uid = 1
tuid = 2, tid = 1, uid = 2
tuid = 3, tid = 1, uid = 3
tuid = 4, tid = 2, uid = 1
tuid = 5, tid = 2, uid = 2
tuid = 6, tid = 3, uid = 3
So we have 3 pictures of apples. All 3 are tagged as apple. 2 are tagged as red and one is tagged as green.
If I wanted to show pictures of apples, but not red apples, I think the query should be this:
Code:
SELECT uid FROM tags_uploads WHERE tid IN (1) AND tid NOT IN (2)
Which should bring back just one result of the green apple, right? Well, it brings back all results. So I believe I am missing some crucial stage of logic here!
Again, thanks in advance for helping out a poor soul.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|