Having count

10/11/2006 - 09:24 por marcwentink | Informe spam
Aqui tengo una relation de 1:1 Organization - Profile. Pero cuando hago
lo siguente hay doblas que quiero borrar. Son errores.

Select org.name, org.relationnumber, prof.id
from organizations org left join profiles prof
on prof.id_organization = org.id
where prof.id is not null order by org.name

Puedo leer todo el resultato, pero no hay una manera como puedo ver
solo las reglas doblas? Algo como:

Select org.name, org.relationnumber, prof.id
from organizations org left join profiles prof
on prof.id_organization = org.id
where prof.id is not null and having count(*) > 1


quizas?
 

Leer las respuestas

#1 Javier Loria
10/11/2006 - 14:14 | Informe spam
Hola:
Algo como:
SELECT org.name
, org.relationnumber
, prof.id
FROM organizations org
LEFT JOI profiles prof
ON prof.id_organization = org.id
WHERE prof.id is not null
GROUP BY org.name, org.relationnumber, prof.id
HAVING count(*) > 1
Saludos,

Javier Loria
Costa Rica-MVP
Solid Quality Learning

wrote in message
news:
Aqui tengo una relation de 1:1 Organization - Profile. Pero cuando hago
lo siguente hay doblas que quiero borrar. Son errores.

Select org.name, org.relationnumber, prof.id
from organizations org left join profiles prof
on prof.id_organization = org.id
where prof.id is not null order by org.name

Puedo leer todo el resultato, pero no hay una manera como puedo ver
solo las reglas doblas? Algo como:

Select org.name, org.relationnumber, prof.id
from organizations org left join profiles prof
on prof.id_organization = org.id
where prof.id is not null and having count(*) > 1


quizas?

Preguntas similares