Thread: Sub-Select problem

Sub-Select problem

From
"Marvin"
Date:
I was trying to do something like this.
 
Select Field1, Field2, Total
FROM
    (Select Field1, Field2, SUM(Field3) as Total
    From TableA
    Where DateHired <= CAST('08/01/2003' AS DATE)
    GROUP BY Field1) as MyTable;
 
The sub-select query tested alone returns me a lot of rows,
however when I make all the query it returns me nothing.
 
Please help!!!
I'm in rush.
 
Thank you in advanced for ANY suggestion,
 
 
MAGO
_________________________________________________________________
  IncrediMail - El E-mail ha evolucionado finalmente - Haga clic aquí
Attachment

Re: Sub-Select problem

From
"Marvin"
Date:
I executed the same query on a command line console and it worked
I think the problem is that I'm using EMS PostgreSQL Manager and
it does not return me anything from the SQL Editor.
 
Thank you for the help.
 
MAGO
 
-------Mensaje original-------
 
Fecha: Jueves, 17 de Julio de 2003 04:23:23 p.m.
Asunto: Re: [ADMIN] Sub-Select problem
 
I executed this same query and all the rows have been showed. The only
problem was I had to include field2 in the group by statement.
I am running postgresql 7.2.3-5.80 over Red Hat 8.

----- Original Message -----
From: Marvin
To: pgsql-admin@postgresql.org
Sent: Thursday, July 17, 2003 7:03 PM
Subject: [ADMIN] Sub-Select problem


I was trying to do something like this.

Select Field1, Field2, Total
FROM
(Select Field1, Field2, SUM(Field3) as Total
From TableA
Where DateHired <= CAST('08/01/2003' AS DATE)
GROUP BY Field1) as MyTable;

The sub-select query tested alone returns me a lot of rows,
however when I make all the query it returns me nothing.

Please help!!!
I'm in rush.

Thank you in advanced for ANY suggestion,


MAGO


_________________________________________________________________
IncrediMail - El E-mail ha evolucionado finalmente - Haga clic aquí

.
_________________________________________________________________
  IncrediMail - El E-mail ha evolucionado finalmente - Haga clic aquí
Attachment