Files
varlog/data/f6266a61-7cac-4aa3-94db-7f977f03dff3/index.md
T

24 lines
690 B
Markdown

![Trouver des doublons en SQL](sql_table_records.jpg)
<panel type="default" title="Code SQL">
<code SQL [enable_line_numbers="true", start_line_numbers_at="1"]>
SELECT COUNT(*) AS nbr_doublon, champ1, champ2, champ3
FROM table
GROUP BY champ1, champ2, champ3
HAVING COUNT(*) > 1
</code>
</panel>
<panel type="default" title="Code SQL">
<code SQL [enable_line_numbers="true", start_line_numbers_at="1"]>
SELECT DISTINCT *
FROM table t1
WHERE EXISTS (
SELECT *
FROM table t2
WHERE t1.ID <> t2.ID
AND t1.champ1 = t2.champ1
AND t1.champ2 = t2.champ2
AND t1.champ3 = t2.champ3 )
</code>
</panel>