I am occasionally getting a strange behavior on one of my queries where the sub-query is returning NULL even though the record exists. Here is the query: Insert into table2 values (2, (select id from table1 where x = '12345' and y = '4567'), 0); The record for table1 where x = '12345' and y = '4567' does exist, but occasionally it puts a Null in the second field for table2 insert query. Any ideas?

