too busy or lazy to write it out right now.... but hereTaken from page :
http://www.mysql.com/doc/en/JOIN.htmlmysql> SELECT table1.* FROM table1
    ->        LEFT JOIN table2 ON table1.id=table2.id
    ->        WHERE table2.id IS NULL;
This example finds all rows in table1 with an id value that is not present
in table2 (that is, all rows in table1 with no corresponding row in table2).
This assumes that table2.id is declared NOT NULL, of course. See section
5.2.6 How MySQL Optimises LEFT JOIN and RIGHT JOIN.
right from the MYSQL site, it is sorta the struct u need.
play with it a little to get values that also have a '2' and not a 0.

Joel




"Rob Day" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having trouble getting the results I want. The database deals with
> libraries and reports they've submitted. Here are the relevant tables with
> the primary keys marked with a star (*):
>
> +--------------+
> | libinfo      |
> +--------------+
> | lib_id*      |
> | lib_name     |
> | city         |
> +--------------+
>
> +---------------+
> | reportinfo    |
> +---------------+
> | report_id*    |
> | lib_id        |
> | exclude       |
> | quarter       |
> +---------------+
>
> In reportinfo.quarter there are currently two possible values, 0 and 2. I
> want libinfo.lib_name and libinfo.city for all entries in libinfo, where
> libinfo.lib_id = reportinfo.lib_id, that do not have an entry in
reportinfo
> where reportinfo.quarter = 0. I don't care if there is an entry in
> reportinfo where quarter = 2. Can someone please help me construct this
> query? Thanks.
> -Rob
>
> P.S. I realize that this question has nothing to do with PHP. But be
assured
> that this is one small part of a PHP/MySQL web application. Thank you for
> your indulgence.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to