Ver Mensaje Individual
  #8 (permalink)  
Antiguo 14/04/2007, 17:45
Section1
 
Fecha de Ingreso: diciembre-2003
Mensajes: 173
Antigüedad: 21 años, 3 meses
Puntos: 1
Re: Como encontrar registros duplicados en una base de datos

He desarrollado un codigo que creo que sera el correcto.

Corregirme porfavor.

Un saludo,
Section1


Codigo
<?php

//Conexion con la base
mysql_connect("localhost","*****","****");
//selección de la base de datos con la que vamos a trabajar
mysql_select_db("servidor");
//Ejecutamos la sentencia SQL

mysql_query("select distinct a.id from test a left join test b on (a.nombre=b.nombre and a.id!=b.id and a.id<b.id) where b.id is not null");

mysql_query("select distinct b.id from test a left join test b on (a.nombre=b.nombre and a.id!=b.id and a.id<b.id) where b.id is not null");

?>