I am trying to get the list of Synonyms and Samples given the wordid. After a lot of trial and error I can get the samples for all the synsets but not the actual synonyms. Here
I'm not sure I exactly understand the question, but wouldn't something like this work?
SELECT s1.wordid, s1.synsetid, s1.sensekey, synsets.definition
, s2.wordid AS matchedWordID, w.* -- Additional info not from question's query
FROM senses AS s1
LEFT JOIN synsets ON s1.synsetid = synsets.synsetid
LEFT JOIN senses AS s2 ON s1.synsetid = s2.synsetid AND s1.wordid <> s2.wordid
LEFT JOIN words AS w ON s2.wordid = w.wordid
WHERE s1.wordid = 79459
;
Note: ...
is just short hand for the list of fields you actually want.
Note#2: You can of course JOIN to samples using the synsets
reference, but keep in mind the results would be repeated for every word pair and sample; and it is possible some word pairs may be repeated if they are synonyms in multiple meanings.