Skip site navigation (1) Skip section navigation (2)

RE: Simple consulta SELECT

From: "Yaremi Paz" <ypazval(at)hotmail(dot)com>
To: edukoski(at)montevideo(dot)com(dot)uy, pgsql-es-ayuda(at)postgresql(dot)org
Subject: RE: Simple consulta SELECT
Date: 2006-06-23 19:15:49
Message-ID: BAY118-F14480734DEB56C919B6F3FA67A0@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-es-ayuda
<html><div style='background-color:'><P><BR><BR></P>
<DIV>
<P>Eduardo escribió:<BR><BR></P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px"><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
</STYLE>
<FONT face=Arial size=2>
<DIV>Estimados</DIV>
<DIV>Tengo esta estructura en una base de datos:</DIV>
<DIV>
<TABLE style="WIDTH: 656px; BORDER-COLLAPSE: collapse; HEIGHT: 325px; BACKGROUND-COLOR: white" width=656 borderColorLight=black border=border>
<TBODY>
<TR>
<TH width=50><FONT size=2>Campo</FONT></TH>
<TH width=80><FONT size=2>Tipo</FONT></TH>
<TH width=40><FONT size=2>Nulo</FONT></TH>
<TH width=70><FONT size=2>Predeterminado</FONT></TH></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>AÑO&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>integer</FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>REGION&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>character varying(255)&nbsp;</FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>AGRICULTURA&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision</FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>V_AGRICULTURA&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>INDUSTR_CONSTR&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>V_INDUSTR_CONSTR&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>COMERCIO_SERVICIOS&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>V_COMERCIO_SERVICIOS&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>NO_CORRESPONDE&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>V_NO_CORRESPONDE&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>double precision<BDO dir=ltr></BDO></FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR>
<TR>
<TD class=print noWrap width=50><FONT size=2>CONTROL_TOTAL&nbsp; </FONT></TD>
<TD class=print noWrap width=80><FONT size=2>character</FONT></TD>
<TD class=print width=40><FONT size=2>Sí&nbsp;</FONT></TD>
<TD class=print noWrap width=70><FONT size=2><I>NULL</I>&nbsp;</FONT></TD></TR></TBODY></TABLE></DIV>
<DIV>&nbsp;</DIV>
<DIV>y tengo la siguiente consulta y no me funciona, es decir no me da error pero no me devuelve nada.</DIV>
<DIV>&nbsp;</DIV>
<DIV>$Query2 ="SELECT MAX(AÑO) &nbsp;FROM ecotabpea ORDER BY REGION";</DIV>
<DIV>Me muestra una tabla sin ningun dato </DIV>
<DIV>Estos son los datos.</DIV>
<DIV>2001&nbsp;MONTEVIDEO&nbsp;1,59&nbsp;&nbsp;20,85&nbsp;&nbsp;69,71&nbsp;&nbsp;7,85&nbsp;&nbsp;100,00<BR>2001&nbsp;INTERIOR URBANO&nbsp;6,77&nbsp;&nbsp;23,52&nbsp;&nbsp;62,22&nbsp;&nbsp;7,49&nbsp;&nbsp;100,00<BR>2002&nbsp;MONTEVIDEO&nbsp;1,3&nbsp;-0,29&nbsp;20,56&nbsp;-0,29&nbsp;69,5&nbsp;-0,2&nbsp;8,64&nbsp;0,79&nbsp;100,01<BR>2002&nbsp;INTERIOR URBANO&nbsp;7,1&nbsp;0,33&nbsp;21,96&nbsp;-1,56&nbsp;63,28&nbsp;1,06&nbsp;7,69&nbsp;0,2&nbsp;100,03<BR>2003&nbsp;MONTEVIDEO&nbsp;1,65&nbsp;0,35&nbsp;19,32&nbsp;-1,24&nbsp;69,94&nbsp;0,44&nbsp;9,09&nbsp;0,44&nbsp;100,00<BR>2003&nbsp;INTERIOR URBANO&nbsp;7,16&nbsp;0,06&nbsp;20,63&nbsp;-1,33&nbsp;63,07&nbsp;-0,2&nbsp;9,14&nbsp;1,45&nbsp;100,00<BR>2004&nbsp;MONTEVIDEO&nbsp;1,85&nbsp;0,2&nbsp;19,68&nbsp;0,35&nbsp;71,69&nbsp;1,75&nbsp;6,79&nbsp;-2,3&nbsp;100,00<BR>2004&nbsp;INTERIOR URBANO&nbsp;7,95&nbsp;0,79&nbsp;20,9&nbsp;0,28&nbsp;64,69&nbsp;1,61&nbsp;6,46&nbsp;-2,68&nbsp;100,00</DIV>
<DIV>&nbsp;</DIV>
<DIV>Saludos Eduardo</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>Eduardo: </STRONG>En mi opinión muy personal, renombra todos los campos de la tabla en postgres por minúsculas y no utilices la letra "ñ" en tu variable "año". Haz el cambio y ejecuta de nuevo la consulta. Ojalá te funcione. Saludos!</DIV>
<DIV>&nbsp;</DIV>
<DIV>Yaremi</DIV></FONT></FONT></BLOCKQUOTE></DIV></div></html>



Attachment: unknown_filename
Description: text/html (5.7 KB)

In response to

pgsql-es-ayuda by date

Next:From: Juan MartínezDate: 2006-06-23 19:21:56
Subject: Re: Filtro de Consultas
Previous:From: Yaremi PazDate: 2006-06-23 19:14:24
Subject: RE: Simple consulta SELECT

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group