Try something like

SELECT fid, Family_Last_Name, Phone, playertable.Family_ID
FROM familytable
LEFT OUTER JOIN playertable ON playertable.Family_ID = familytable.fid
                           AND playertable.SportRegistered = 'O'
GROUP BY fid
ORDER BY Family_Last_Name ASC;

The rows from familytable which are not matched by rows in playertable will be 
recognized by NULL values of playertable.Family_ID in the result set.

--Greg Johnson

        -----Original Message-----
        From:   Dave Carter [mailto:[EMAIL PROTECTED]]
        Sent:   Friday, June 22, 2001 10:19 AM
        To:     mysql
        Subject:        Does not match

        Can I show records from my SQL statement where records both have a match and
        do NOT have a match. I'm having trouble with the syntax for "no matching
        records" in a related table, my current SQL statment looks like this:


        SELECT fid,Family_Last_Name,Phone  FROM familytable,playertable WHERE
        playertable.Family_ID = familytable.fid AND playertable.SportRegistered =
        '0' GROUP BY fid ORDER BY Family_Last_Name ASC;


        This works fine, but I also want to show Families with NO matching records
        in the player field, which the above statement does not do.....

        TIA,

        Dave Carter
        Chief Web Architect
        Accelerated Business Technologies, Inc.
        http://www.abti.cc
        717.464.2970





        ---------------------------------------------------------------------
        Before posting, please check:
           http://www.mysql.com/manual.php   (the manual)
           http://lists.mysql.com/           (the list archive)

        To request this thread, e-mail <[EMAIL PROTECTED]>
        To unsubscribe, e-mail <[EMAIL PROTECTED]>
        Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to