El mar, 05-07-2011 a las 10:54 -0500, Giorgio 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 >
Se me ocurre que hagas unas función donde pases el socio y obtenga en MAX (version::int) algo como: SELECT MAX (version::int) AS version FROM tabla WHERE codigo= codigo_socio GROUP BY codigo; > -- Saludos, Gilberto Castillo Edificio Beijing. Miramar Trade Center. Etecsa. Miramar, La Habana.Cuba.
--- This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE running at host imx2.etecsa.cu Visit our web-site: <http://www.kaspersky.com>, <http://www.viruslist.com>
- Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda@postgresql.org) Para cambiar tu suscripción: http://www.postgresql.org/mailpref/pgsql-es-ayuda