/*Sauvegarde Immobilier Loyer*/; /*Version 1.8.4 */ ; ALTER IGNORE TABLE loyer drop KEY doublon ; ALTER IGNORE TABLE `loyer` CHANGE `nom` `nom` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ; ALTER IGNORE TABLE loyer ADD UNIQUE KEY doublon (contrat_id, local_id, nom, locataire_id, loy, charges, tva, echeance, periode_du, periode_au, proprietaire_id); DELETE FROM loyer WHERE id NOT IN (SELECT * FROM (SELECT MIN(l.id) FROM loyer l GROUP BY contrat_id , local_id ,nom ,locataire_id ,montant_tot ,loy ,solde ,paiepartiel, charges ,caf ,tva ,remise_ex ,charge_ex ,echeance ,commentaire ,statut ,paiement ,periode_du ,periode_au ,encours ,regul ,proprietaire_id) x);