Skip to content

Instantly share code, notes, and snippets.

@josephcc
Last active August 2, 2017 00:54
Show Gist options
  • Save josephcc/f1aa59ab975908554b609925c06f3df7 to your computer and use it in GitHub Desktop.
Save josephcc/f1aa59ab975908554b609925c06f3df7 to your computer and use it in GitHub Desktop.
select W1.review_id, W1.index, W2.index, W1.token, W2.token
from index W1 INNER JOIN index W2
ON (
(W1.token = 'stand' AND W2.token = 'behind' AND
W1.review_id = W2.review_id AND
W1.index + 1 = W2.index) OR
(W1.token = 'stand' AND W2.token = 'up' AND
W1.review_id = W2.review_id AND
W1.index + 1 = W2.index) OR
(W1.token = 'stood' AND W2.token = 'behind' AND
W1.review_id = W2.review_id AND
W1.index + 1 = W2.index)
)
WHERE
W1.token IN ('stand', 'stood') AND W2.token IN ('behind', 'up') AND W1.city = 'Pittsburgh' AND W2.city = 'Pittsburgh'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment