Just add a DISTINCT to the SELECT query, but this makes every field get tested for duplicates (as far as I am aware). So if the SELECT returned something like:Can you put an example of you use DISTINCT w/ this technique
Code: Select all
SELECT DISTINCT pkid, fkid, fname, lname, ageCode: Select all
0, 1, 'Alex', 'Barylski', 31
0, 1, 'Alex', 'Barylski', 31Only one of the above records would be returned and INSERTed into the table. If you need to remove duplicates based on specific criteria, you could use a GROUP BY and explicitly state which fields are checked.
Code: Select all
SELECT
pkid,
fkid,
fname,
lname,
age
FROM
table(s)
GROUP BY
fname, lnameCheers,
Alex