Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

complex boolean and join query

695392Apr 22 2009 — edited Apr 24 2009
Hi,

Previously I wanted a boolean and query across a word OCCURRENCE table. Now I want to add functionality that queries across a METADATA table in addition to the OCCURRENCE table to give the user the option.

The first table is:

OCCURRENCE_TBL
------------
BOOK_ID
PAGE_ID
WORD indexed
RANK_VAL

The second table is:

METADATA_TBL
----------------------
BOOK_ID
ATTR_1
ATTR_2
ATTR_3
....
ATTR_N

My first query caught the PAGE_ID and BOOK_ID (s) of all and-ed occurrences of a set of words by rank. You guys helped me with

select page_id, sum(rank_val)
from occurrence_tbl
where word in ('word1', 'word2', 'word3')
group by page_id
having count(word)=3
order by sum(rank_val) desc

with the recommendation to just index on WORD in OCCURRENCE_TBL

Now, how do I make a similar query against both OCCURRENCE_TBL and METADATA_TBL for 'word1' AND 'word2' AND 'word3'? In particular, an occurrence of one of the words must be in either table joined by BOOK_ID. What I was thinking was that I should augment the OCCURRENCE_TBL with records for the metadata column words in each book and give two ranks, one for the content only and one for the metadata and content. Is this the right approach rather than trying some kind of table join query?

Thanks,
Andy
This post has been answered by JustinCave on Apr 23 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 22 2009
Added on Apr 22 2009
7 comments
522 views