Re: NATURAL LEFT JOIN behaves strangely

Re: NATURAL LEFT JOIN behaves strangely

am 14.04.2003 08:30:54 von josef.zlomek

Hi,

I played with it a bit and found out that when I add parenthesis
around table1 NATURAL LEFT JOIN table2
it works well:

mysql> SELECT host.HID,HostType,FullName,FileName,FileSize,FileDate FROM (file NATURAL LEFT JOIN path) NATURAL LEFT JOIN host;
+------+----------+----------+----------+----------+-------- -------------+
| HID | HostType | FullName | FileName | FileSize | FileDate |
+------+----------+----------+----------+----------+-------- -------------+
| 5 | 2 | /dir1 | file.txt | 0 | 2002-04-13 20:58:00 |
| 5 | 2 | /dir2 | file.txt | 0 | 2002-04-13 20:58:00 |
+------+----------+----------+----------+----------+-------- -------------+
2 rows in set (0.01 sec)

mysql> SELECT host.HID,HostType,FullName,FileName,FileSize,FileDate FROM file NATURAL LEFT JOIN path NATURAL LEFT JOIN host;
+------+----------+----------+----------+----------+-------- -------------+
| HID | HostType | FullName | FileName | FileSize | FileDate |
+------+----------+----------+----------+----------+-------- -------------+
| 5 | 2 | | file.txt | 0 | 2002-04-13 20:58:00 |
| 5 | 2 | | file.txt | 0 | 2002-04-13 20:58:00 |
| 5 | 2 | /dir1 | file.txt | 0 | 2002-04-13 20:58:00 |
| 5 | 2 | /dir1 | file.txt | 0 | 2002-04-13 20:58:00 |
| 5 | 2 | /dir2 | file.txt | 0 | 2002-04-13 20:58:00 |
| 5 | 2 | /dir2 | file.txt | 0 | 2002-04-13 20:58:00 |
+------+----------+----------+----------+----------+-------- -------------+
6 rows in set (0.02 sec)

Josef

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org