Results 1 to 6 of 6
Thread: Multiple 'OR' or just IN
Jan 21, 2002, 16:07 #1
- Join Date
- Oct 2000
- 0 Post(s)
- 0 Thread(s)
Multiple 'OR' or just IN
Browsing SP for inspiration I came across the following thread (Key Points Cut Below): - http://www.sitepointforums.com/showt...threadid=39635
Do you have any views on whether the following mysql query is efficient - is there a better way of doing it?
$query = "SELECT email FROM email_tbl WHERE email = '$email1' OR email = '$email2' OR email = '$email3' OR email = '$email4' ";
$list = array($email1, $email2, $email3, $email4);
$query = 'SELECT email FROM email_tbl WHERE email IN("' . implode('","', $list) . '")';
I've never seen mention of the IN syntax and can't find it in Kevin's or Wrox's books so I was wondering if anyone can provide me with more information on it and if it is actually more efficient than using OR or just makes more readable code.
Many Thanks in advance