I have a mail table with four columns: id, userto, userfrom, and message. I want to receive a list of users that have either sent mail to user "example", and I want to join it with a list of users that user "example" sent mail to. However, I don't want any repeating usernames in this list.
How would I do this? I'm sure it has something to do with SELECT DISTINCT and INNER JOIN, but I'm not sure how I would go about doing it.