This one has stumped me.
A quick overview
I need to be able to get all email addresses of people who have participated in a message thread. People can add messages to this messageThread via a few different means, and because people can either be the sender or receive a message, the email addresses might be in different columns.
Here is an example table.
messagesTable
ID | threadKey | fromEmail | toEmail | sentBy | sentTo
1 | ASJHD2 | me@exam.com | you@bob.com | null | null
2 | ASJHD2 | jake@k.com | | null | null
3 | ASJHD2 | | | 55 | 88
I also have my Users table.
ID | username | email
55 | Ike | ike@domain.com
88 | Sam | sam@j.com
Now is it possible to get all of the distinct emails that have participated in the message with a threadKey of ASJHD2. Keeping in mind that there would also need to be a join on the users table.
First try to get just emails like