![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |