Re: Ayuda con query

From: Espartano <espartano(dot)mail(at)gmail(dot)com>
To: "Juan Jose Rosales Rodriguez" <jjrosales(at)estudiantes(dot)uci(dot)cu>
Cc: hermeszambra(at)yahoo(dot)com, "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>, "Juan Ramirez" <juanrmiranda(at)hotmail(dot)com>, "PostGreSQL Lista de Ayuda" <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Ayuda con query
Date: 2009-01-15 17:16:51
Message-ID: d353bd50901150916r2ee9d63bxa0e9953ea1d7e4cb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Es mi idea o este es otro problema muy aparte del primero, lo siento
no he leido el Thread completo

2009/1/15 Juan Jose Rosales Rodriguez <jjrosales(at)estudiantes(dot)uci(dot)cu>:
> Buenas tardes tengo orto problemita
>
> Quiero sacar lod datos duplicados de un campo
> algo asi
>
>
> Nombre| Edad |SEXO
> ------- -|---------|------------
> JUAN | 12 | M
> OMAR| 13 | M
> JUAN | 12 | M
> JUAN | 12 | M
> JUAN | 12 | M
> JUAN | 12 | M
> pepe | 12 | M
> pepe | 12 | M
> pepe | 12 | M
>
> y da como result si busca por nombre el duplicado quedaria asi
>
> Nombre| Edad |SEXO
> ------- -|---------|------------
> JUAN | 12 | M
> JUAN | 12 | M
> JUAN | 12 | M
> JUAN | 12 | M
> JUAN | 12 | M
> pepe | 12 | M
> pepe | 12 | M
> pepe | 12 | M
>

select nombre, edad, sexo, count(*) from <TABLA> group by nombre,
edad, sexo having count(*) > 1

prueba con este select

--
"Linux is for people who hate Windows, BSD is for people who love UNIX".
"Social Engineer -> Because there is no patch for human stupidity"
"The Unix Guru's View of Sex unzip ; strip ; touch ; grep ; finger ;
mount ; fsck ; more ; yes ; umount ; sleep."
"Documentation is like sex: when it is good, it is very, very good;
and when it is bad, it is better than nothing."

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Javier Chávez B. 2009-01-15 17:26:00 Re: Ayuda con query
Previous Message Alvaro Herrera 2009-01-15 17:13:51 Re: Ayuda con query