Re: column filter

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 27 Feb 2009 20:37:54 +0100
Message-ID: <49a84113$0$26191$426a74cc_at_news.free.fr>


"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 Received on Fri Feb 27 2009 - 13:37:54 CST

Original text of this message