RE: [PHP] is there a more efficient query?
| From: | Jason Davidson | Date: | Fri, 06 Aug 2004 16:47:00 +0000 |
| Subject: | RE: [PHP] is there a more efficient query? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-193013@lists.php.net to get a copy of this message | ||
I would use IN, or even BETWEEN if there exists such a function...
Jay's example is much cleaner and readable.
Jason
"Jay Blanchard" <jay.blanchard@niicommunications.com> wrote:
>
> [snip]
> Tis SQL ....
>
> SELECT value
> FROM element_values
> WHERE user = $user_id
> AND(element=48
> OR element=52
> OR and so on....)
> [/snip]
>
> You can also use IN
>
> SELECT value
> FROM element_values
> WHERE user = $user_id
> AND element IN ('48', '52',...)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>