I am comparing two tables, domains and temp, to find records with a field that
has been modified. I create the temp table with
create table temp like domains;
then [eventually] create a table t3 that contains the domain name of any record
that does not match. My question is about 'natural join'.
I would have thought that the following two queries are equivalent:
1) select t.name,t.expires,d.expires from domains as d natural join temp as t
where d.expires>t.expires;
2) select t3.name,t.name,t.expires,d.expires from t3,domains as d,temp as t
where t.name=t3.name and d.name=t3.name and d.expires>t.expires;
The natural join finds no records, the second query works.
The structure of the tables domain and temp is:
+-----------+---------------------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------------+------+-----+------------+-------+
| Custid | int(11) | | MUL | 0 | |
| Name | varchar(150) | | PRI | | |
| User | varchar(16) | | MUL | | |
| Active | tinyint(3) unsigned | | | 0 | |
| Created | date | YES | | NULL | |
| Expires | date | | | 0000-00-00 | |
| Registrar | varchar(50) | | | | |
| Managed | varchar(50) | YES | | NULL | |
| status | varchar(20) | YES | | NULL | |
| Start | date | YES | | NULL | |
+-----------+---------------------+------+-----+------------+-------+
I am using 4.1.20. As always thank you for your insights.
Doug
_____
Douglas Denault
http://www.safeport.com
d...@safeport.com
Voice: 301-217-9220
Fax: 301-217-9277
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org