My construction:
INSERT INTO ... ( SELECT ... FROM .. JOIN ... ON ... WHERE ... ORDER BY ... )
Short description: I'm using Select to insert data from 2 tables (using JOIN) to another table. The result of Select is something like (after order by):
col_a | col_b | col_c | col_d
1111 44 xxx yyy
1111 66 xxx yyy
2222 12 aaa bbb
3333 55 ccc ddd
3333 68 xxx yyy
If the row is duplicated (col_c) i want to insert to my table first matched row.
Example of result should be like this:
col_a | col_b | col_c | col_d
1111 44 xxx yyy
2222 12 aaa bbb
3333 55 ccc ddd