Re: column filter

From: Carl Forsman <fatwallet951_at_yahoo.com>
Date: Fri, 27 Feb 2009 12:12:20 -0800
Message-ID: <v8igq45d4jo0q81lvr0ja14mv4etd45e9a_at_4ax.com>



On Fri, 27 Feb 2009 20:37:54 +0100, "Michel Cadot" <micadot{at}altern{dot}org> wrote:

>
>"Carl Forsman" <fatwallet951_at_yahoo.com> a ?crit dans le message de news: 2dfgq4lnlp186te0dcb3hoduur8fu7va2b_at_4ax.com...
>| 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;
>
>Use greatest and least functions.
>
>Regards
>Michel
>

but the query returns 2 row has the same word

(word1)(word2)	(word3)
a,	young,	woman
a,	woman,	young
a, 	fish,	dive

===================

since "a,young,woman" and "a,woman,young" are duplicated I only want query return
(word1)(word2)	(word3)
a,	young,	woman
a, 	fish,	dive

-OR-

(word1)(word2)	(word3)
a,	woman,	young
a, 	fish,	dive
Received on Fri Feb 27 2009 - 14:12:20 CST

Original text of this message