Bug #8761 | Using LEFT JOIN creates a resultset with NULL values when there is no ID common | ||
---|---|---|---|
Submitted: | 24 Feb 2005 0:25 | Modified: | 25 Feb 2005 19:50 |
Reporter: | Disha | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.2 | OS: | Windows (Windows 2003) |
Assigned to: | CPU Architecture: | Any |
[24 Feb 2005 0:25]
Disha
[24 Feb 2005 5:41]
MySQL Verification Team
Couldf you please send a test case with a dump of the tables and the query using the same tables names. Thanks.
[25 Feb 2005 19:50]
Trudy Pelzer
This is not a bug. First, tables asht1 and asht2 do not exist. But if one changes the query to: mysql> select t1.fname, t2.fname, t2.count from t1 LEFT JOIN t2 ON t1.fname=t2.fname; +-------+-------+-------+ | fname | fname | count | +-------+-------+-------+ | A1 | NULL | NULL | | M2 | NULL | NULL | | F3 | NULL | NULL | | C4 | NULL | NULL | | V5| NULL | NULL | +-------+-------+-------+ 5 rows in set (0.00 sec) One gets the correct result: every value of fname in table t1, with NULLs for the non-matching values in table t2. Adding the extra column makes it clear the result is correct, but even without the extra column, MySQL is returning the correct result.