Let say i have four tables PAGE, USER, TAG and PAGE-TAG
PAGE has fields ID, CONTENT ...
TAG has fields ID, NAME ...
USER has fields ID, NAME ...
PAGE-TAG has fields ID, PAGE-ID, TAG-ID, USER-ID
Let say i have four pages
PAGE#1 'Content page 1' tagged with tag#1 by user1, tagged with tag#1 by user2
PAGE#2 'Content page 2' tagged with tag#3 by user2, tagged by tag#1 by user2, tagged by tag#8 by user1
PAGE#3 'Content page 3' tagged with tag#7 by user#1
PAGE#4 'Content page 4' tagged with tag#1 by user1, tagged with tag#8 by user1
I expect my query to look something like this:
select page.content ?
from page, page-tag
where
page.id = page-tag.pag-id
and page-tag.tag-id in (1, 3, 8)
order by ? desc
I would like to get such an output:
Content page 2, 3
Content page 4, 2
Content page 1, 1
thanks in advanced for the feedback.