so here’s what I accomplished right now:
- given email1 and email2,
- get all emails that are not equal to
email1 - create a list of them
- check if email2 exists in the list
- if it does return false, if it does
not return true
Is there a way to accomplish this via a query instead of creating a list and searching if email2 exists in it? (because I’ve implemented the above pseudo in PHP and I had a query object and an array…ugly approach)
given a user table with the following schema
id INT(11) PRIMARY KEY
email VARCHAR(100)
The query:
Just see if it returns any rows.
This won’t work if email1 is equal to email2, but if that were the case then it wouldn’t be worth running the query in the first place.