Page 1 of 1

Is it possible to search 2 emails in 1 BD call?

Posted: Mon Sep 19, 2016 3:23 pm
by hybris
Hi,

Im probably tired but is there some elegant solution to search if 2 different emails exist in a DB and sseparate the results in just 1 DB search?

I have a user DB that holds useremail (unique)

I have a form where you can register a company that have like commersialcontactemail (CCEmail) and technicalcontactemail (TCEmail).
When submitting the form i want to search the user db to see if the CCEmail or TCEmail exist and if so add the user id to a field.

I can easily solve this by doing separate searches like first i search if row=1 for CCEmail and then I do another search for the TCEmail. But this means I have to search the DB 2 times (Not a disaster, Im just curious if there is a better way to do this).

((Also I dont mean search if either CCEmail or TCEmail exist because i need to know if its CCEmail or TCEmail so i update in the right column.))

Thanks

Re: Is it possible to search 2 emails in 1 BD call?

Posted: Mon Sep 19, 2016 4:32 pm
by requinix
If you can't do "email = cc or email = tc" then doing it twice is probably the best way.

Shorter code doesn't always mean better code.