mysql select statement with unique and maximum selects?

FL

New Member
I have a number of records that I would like to insert into a MYSQL table 'table1'. Some of them are duplicates.I have a composite unique constraint made of 'FIELD A' and 'DUP_NUMBER' so a group of records would look schematically like:\[code\]ID FIELD A DUP_NUMBER 1 text1 02 text2 03 text2 14 text2 25 text3 0\[/code\]one more time to actually insert it into the table. Is this possible if so how would I do it?I am looking for a mysql select statement that would select only unique entries in FIELD a, but with the added proviso that you get the highest DUP_NUMBER .The resultset should look like:\[code\]ID FIELD A DUP_NUMBER 1 text1 04 text2 25 text3 0\[/code\]Thanks in advance,Bill
 
Top