I am hoping to do something like:
SELECT client.id FROM client RIGHT JOIN ('no@such.com', 'a@b.com', ...);
I have the following “client” table:
id email
1 a@b.com
2 c@d.com
The user inputs a list of email addresses that he wants to invite, and I need to get the following result:
email_to_invite client.id
no@such.com NULL
a@b.com 1
so that I know who is already in the DB (and get’s a message with the internal message system), and who I need to invite by email (client.id IS NULL)
SOLUTION: (Thanks to Joe Stefanelli)
First I had to grant CREATE TEMPORARY TABLES permission to my user
CREATE TEMPORARY TABLE email (email VARCHAR(255));
INSERT INTO email VALUES ('no@such.com'), ('a@b.com');
SELECT e.email, c.id FROM email e LEFT JOIN client c ON e.email=c.email;
Put the user list into a temporary table and join against that.