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:
ID FIELD A DUP_NUMBER
1 text1 0
2 text2 0
3 text2 1
4 text2 2
5 text3 0
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:
ID FIELD A DUP_NUMBER
1 text1 0
4 text2 2
5 text3 0
Thanks in advance,
Bill