Re: join statement

From: CarlosAL <miotromailcarlos_at_netscape.net>
Date: Tue, 24 Feb 2009 23:56:52 -0800 (PST)
Message-ID: <7d843063-5d0d-4e2d-8513-18b92e6d516a_at_a39g2000yqc.googlegroups.com>



On 25 feb, 08:03, Carl Forsman <fatwallet..._at_yahoo.com> wrote:
> 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. Received on Wed Feb 25 2009 - 01:56:52 CST

Original text of this message