Re: Help con Select

From: Arcel Labrada Batista <alabradab(at)uci(dot)cu>
To: Alejandra Bautista <alejandrabaut(at)gmail(dot)com>
Cc: Postgresql <pgsql-es-ayuda(at)postgresql(dot)org>, Giorgio <giorgio(dot)pgsql(at)gmail(dot)com>
Subject: Re: Help con Select
Date: 2011-07-05 20:43:30
Message-ID: 32654239.1020901309898610917.JavaMail.root@ucimail1.uci.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

si agrupas por codigo no te va a funcionar, pues el codigo siempre es distinto, creo que no deberias incluirlo en el select no el el group by

----- Mensaje original -----
De: "Alejandra Bautista" <alejandrabaut(at)gmail(dot)com>
Para: "Giorgio" <giorgio(dot)pgsql(at)gmail(dot)com>
CC: "Postgresql" <pgsql-es-ayuda(at)postgresql(dot)org>
Enviados: Martes, 5 de Julio 2011 14:57:17 GMT -05:00 Región oriental EE. UU./Canadá
Asunto: Re: [pgsql-es-ayuda] Help con Select

Podria ser algo asi:

SELECT MAX(version::integer), codigo, modular, nombre FROM socio GROUP BY codigo, modular, nombre

El 5 de julio de 2011 09:51, Giorgio < giorgio(dot)pgsql(at)gmail(dot)com > escribió:

Hola amigos espero me puedan ayudar, tengo una tabla socio mas o menos así:

codigo..version.._modular............nombre
00001 01 7000000483 ALARCON ORTIZ SILVIA ESDENKA
00001 02 7000000483 ALARCON ORTIZ SILVIA ESDENKA
00002 01 1031125501 ALBINAGORTA REYNOSO HERLINDA ISABEL
00003 01 8000000872 ALFARO AGUERO PABLO RENE
00004 01 1031148858 ALTAMIRANO VARGAS AUGUSTO
00004 02 1031148858 ALTAMIRANO VARGAS AUGUSTO
00004 03 1031148858 ALTAMIRANO VARGAS AUGUSTO
00005 01 1031152138 ALTAMIRANO VARGAS ELIAS
00006 01 1031125811 ALTAMIRANO VIVANCO LUISA
00006 02 1031125811 ALTAMIRANO VIVANCO LUISA
00006 03 1031125811 ALTAMIRANO VIVANCO LUISA
00006 04 1031125811 ALTAMIRANO VIVANCO LUISA

Donde version es el campo que diferencia el numero de version en la que se registra a un socio

Quisiera obtener solo las ultimas versiones, teniendo en cuenta que un socio puede tener una version 03 o 04, la idea es que quede asi:

codigo..version.._modular............nombre
00001 02 7000000483 ALARCON ORTIZ SILVIA ESDENKA
00002 01 1031125501 ALBINAGORTA REYNOSO HERLINDA ISABEL
00003 01 8000000872 ALFARO AGUERO PABLO RENE
00004 03 1031148858 ALTAMIRANO VARGAS AUGUSTO
00005 01 1031152138 ALTAMIRANO VARGAS ELIAS
00006 04 1031125811 ALTAMIRANO VIVANCO LUISA

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2011-07-05 20:58:14 Re: Help con Select
Previous Message Alejandra Bautista 2011-07-05 18:57:17 Re: Help con Select