dbTalk Databases Forums  

join statement

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss join statement in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carl Forsman
 
Posts: n/a

Default join statement - 02-25-2009 , 01:03 AM






The following query will output 2 word that's close in position, but
how can I output 3 word that's close in position instead of 2 word?
the query will have 3 column output instead of 2 column output for
words.

SELECT A.word As word1, B.word AS word2, A.document
FROM Data AS A
JOIN Data AS B
ON A.document = B.document
AND A.position < B.position
AND ABS(A.position - B.position) < 3;



Notes on Table and output:
===========================
I have a Table stores keywords + position of the word + document
number 1 or 2 ... the word in.

Word Position Document
Great 1 1
Wall 2 1
China 3 1
Dog 3 2
Cat 7 2

===========================
I would like to output all word that are close related ... position of
2 word do not more than 3 word apart :

The output should be:
(Word1)(Word2)(Document#)
Great Wall 1
Wall China 1
Great China 1




Reply With Quote
  #2  
Old   
CarlosAL
 
Posts: n/a

Default Re: join statement - 02-25-2009 , 01:56 AM






On 25 feb, 08:03, Carl Forsman <fatwallet... (AT) yahoo (DOT) com> wrote:
Quote:
The following query will output 2 word that's close in position, but
how can I output 3 word that's close in position instead of 2 word?
the query will have 3 column output instead of 2 column output for
words.

SELECT A.word As word1, B.word AS word2, A.document
FROM Data AS A
JOIN Data AS B
ON A.document = B.document
AND A.position < B.position
AND ABS(A.position - B.position) < 3;

Notes on Table and output:
===========================
I have a Table stores keywords + position of the word + document
number 1 or 2 ... the word in.

Word Position Document
Great 1 1
Wall 2 1
China 3 1
Dog 3 2
Cat 7 2

===========================
I would like to output all word that are close related ... position of
2 word do not more than 3 word apart :

The output should be:
(Word1)(Word2)(Document#)
Great Wall 1
Wall China 1
Great China 1
Homework, eh?

I'm too old to go back to school.

Cheers.

Carlos.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.