How about
INSERT INTO original_table SELECT MAX(f1), f2, f3 FROM new_table GROUP BY f2, f3;
Michael
Stephen E. Bacher wrote:
I had a similar problem, but my criteria for selecting the value of "f1" was different; it's a date field and I wanted only the rows with the most recent date value in that field, so only the "latest" of otherwise identical entries got inserted.
I ended up doing something like this:
create temporary table temp_table ( t_f1 date, t_f2 varchar(100) unique, t_f3 varchar(100) unique );
insert ignore into temp_table select f1,f2,f3 from new_table order by f1 desc;
insert into original_table select * from temp_table;
If there is a better way to do this, I would like to know about it.
- seb
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]