Or, you could try this:
SELECT available.target, tracked.sensor
FROM available LEFT JOIN tracked ON available.target=tracked.target
AND tracked.window=137
WHERE available.window=137 AND available.sensor=8;
-----Original Message-----
From: George Eric R Contr AFSPC/CVYZ
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 03, 2001 12:08 PM
To: [EMAIL PROTECTED]
Subject: RE: Left Join problem
Ok, I can see that now. If the record doesn't exist in the tracked
table,
it can't meet the window criteria.
The one way I see to get around this, in the absense of subselects, is
to
retrieve the tracked data that meets the window criteria into a
temporary
table. Right?
-----Original Message-----
From: Johnson, Gregert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 03, 2001 10:03 AM
To: [EMAIL PROTECTED]
Subject: RE: Left Join problem
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
---------------------------------------------------------------------
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