First, assume you want to insert records, then only insert the records you want to add to the destination table.
INSERT destinationtablename (<destination field list>) SELECT <matching field list> FROM sourcetablename WHERE .... Basically if you can build a query to return the records you want to INSERT, you can stick an INSERT clause to the front of it to make those records end up in some table. http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html Shawn Green Database Administrator Unimin Corporation - Spruce Pine "Josh Howe" <[EMAIL PROTECTED]> wrote on 10/19/2004 12:45:30 PM: > if (select count(*) from z_mail_systems > 0) then [insert statement] > endif; > > > > How do I do this kind of conditional insert? Thanks. >