Some of you probably know this trick to select rows from one table with an ID value that doesn't exist in another table:
mysql> SELECT table1.* FROM table1
-> LEFT JOIN table2 ON table1.id=table2.id
-> WHERE table2.id IS NULL;
But now take look at this particular situation:
CREATE TABLE `table1` (
`id` int(11) NOT NULL auto_increment,
`data` varchar(255) NOT NULL default '',
`created` timestamp(14),
PRIMARY KEY (`id`)
);
Same goes for table 2.
Now this is my problem: how can i select rows from table 1 with a timestamp `created` that doesn't exist in table 2? the IS NULL trick doesn't seem to work. I guess that is because a timestamp can never be null.
Thanx in advance!
mysql> SELECT table1.* FROM table1
-> LEFT JOIN table2 ON table1.id=table2.id
-> WHERE table2.id IS NULL;
But now take look at this particular situation:
CREATE TABLE `table1` (
`id` int(11) NOT NULL auto_increment,
`data` varchar(255) NOT NULL default '',
`created` timestamp(14),
PRIMARY KEY (`id`)
);
Same goes for table 2.
Now this is my problem: how can i select rows from table 1 with a timestamp `created` that doesn't exist in table 2? the IS NULL trick doesn't seem to work. I guess that is because a timestamp can never be null.
Thanx in advance!