Thanks for replying so quickly!
What i want to do is:
I have already broken down a user's search term and got the various word_id's for each word from another table. If the user has searched for 2 words which just happen to have the id's of 17 and 20, i want to do the following:
here is the table again:
word_id | word_position | page_reference
I want to select the value of page_ref when the word_position value of word_id 17 is 1 value higher than the word_position of word_id 20. So for example, i want a search of the following table for word_id 17 and word_id 20:
word_id | word_position | page_reference
========================================
17 | 94 | 5
----------------------------------------
20 | 35 | 7
----------------------------------------
24 | 67 | 11
----------------------------------------
17 | 53 | 18
----------------------------------------
20 | 95 | 5
----------------------------------------
20 | 54 | 18
(i had to use code to get the layout right)
to produce the following output:
page_ref
5
18
since in this random example, 5 and 18 are the only two which satisfy the query. I hope this clears it up a bit. Thanks.