Re: column filter

From: Michael Austin <maustin_at_firstdbasource.com>
Date: Fri, 27 Feb 2009 16:54:51 -0600
Message-ID: <Ce_pl.11550$pr6.7103_at_flpi149.ffdc.sbc.com>



Carl Forsman wrote:
> The following query will return 3 word in 3 "TABLE COLUMN", How can I
> modify the query to return "NO 3 words are the same"?
>
> the following Table will have duplicated as both row has the same 3
> words, I only need "a, young, woman" is enough. I do not need "a,
> woman, young"
> =======================
> a, young, woman <-- both row has same 3 word, I only need 1 row
> a, woman, young
> =======================
> (word1)(word2) (word3)
> a, young, woman
> a, woman, young
> a, fish, dive
> ....
>
> =======================
> SELECT DISTINCT A.word As word1, B.word AS word2, C.word AS word3
>
> 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
>
> LEFT JOIN Data AS C
>
> ON A.document = C.document
>
> AND A.position <> C.position
>
> AND C.position <> B.position
>
> AND (ABS(A.position - C.position) < 3
>
> OR ABS(B.position - C.position) < 3) order by word1;

Don;t multi-post use cross-post instead. same question is in the MySQL   NG - are you using Oracle or MySQL - your answer could be different.

sounds like homework to me... Received on Fri Feb 27 2009 - 16:54:51 CST

Original text of this message