It looks to me as though the "tracked.window=137" condition is suppressing output of 
any "available" rows which do not have a target match in "tracked" - tracked.window 
would = NULL in those cases.

--Greg Johnson

                -----Original Message-----
                From:   George Eric R Contr AFSPC/CVYZ 
[mailto:[EMAIL PROTECTED]]
                Sent:   Wednesday, October 03, 2001 11:50 AM
                To:     [EMAIL PROTECTED]
                Subject:        Left Join problem

                I'm not getting the behavior I expect from this select.

                SELECT available.target, tracked.sensor
                FROM available LEFT JOIN tracked ON available.target=tracked.target
                WHERE available.window=137 AND tracked.window=137 AND 
available.sensor=8;

                Now, I know for this window, that there are 25 records for sensor 8 in 
the
                available table:

                SELECT count(*) FROM available WHERE window=137 AND sensor=8;

                count(*)
                25

                Now in the tracked table, some of the targets that are available to 
sensor 8
                are actually tracked by another sensor, and some are not tracked at 
all.  I
                expected the left join to show me which targets that are available to 
target
                8 are tracked by which sensor, with NULL values in the right column for
                targets that are left untracked.

                I get half of that.  My result set has 20 records.  It correctly shows 
which
                sensor tracked which target. It doesn't show the 4 untracked targets 
at all?

                Ideas?
                Thanks
                Eric

                ---------------------------------------------------------------------
                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