[thelist] Nested Queries

Jay Blanchard jay.blanchard at niicommunications.com
Wed Aug 21 10:45:01 CDT 2002


[snip]
Jay:
How would your query look?
[/snip]

I really thought about it like this. Let's say tblEmail like; (and on second
thought you may not need the other table. This would be easy to manage;

****************************************************
* email       * group1  * group2 * group3 * group4 *
****************************************************
* me at me.com   * drinker * smoker * dancer * NULL   *
* you at you.com * dancer  * NULL   * NULL   * NULL   *
****************************************************

SELECT email
FROM tblEmail
WHERE group1 = "$search_variable"
OR group2 = "$search_variable"
OR group3 = "$search_variable"
OR group4 = "$search_variable"

If my $search_variable is 'dancer' it would return
me at me.com
you at you.com

but if 'smoker' the return would be
me at me.com

HTH!

Jay

***********************************************************
* Texas PHP Developers Conf  Spring 2003                  *
* T Bar M Resort & Conference Center                      *
* New Braunfels, Texas                                    *
* San Antonio Area PHP Developers Group                   *
* Interested? Contact jay.blanchard at niicommunications.com *
***********************************************************






More information about the thelist mailing list