Hi, Mysql 4.0.14
In a seconrio, some reocrds are missing from a child table. If we run this query it returns the missing records: select a.field1, b.field2 from table1 a left join table2 b on (a.field1 = b.field1) where b.field1 is null I want to create entries in the child table (table2) for the missing records. In table2 the primary key is of type Integer, for each new entry it should be Max(table2.PrimaryKeyfield) + 1. How can I do this in one sql command (or is it possilbe at all)? something like: Insert into table2 (primarykeyfiled, field1, field2) Max(table2.priamrykeyfield) + 1 select a.field1, a.field2 from table1 a left join table2 b on (a.field1 = b.field1) where b.field1 is null regards ___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]