Kind of a convoluted question but, basically I have a many to many table word_relationships:
word_relationships
+-----+--------+--------+ | ID | WORD_A | WORD_B | +--
This should work:
SELECT id FROM word_relationships WHERE (Word_A = w1 AND Word_B = w2) OR (Word_A = w2 AND Word_B = w1)