pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: [GENERAL] Getting the result of a query using COUNT(*)
4+ messages / 4 participants
[nested] [flat]

* Re: [GENERAL] Getting the result of a query using COUNT(*)
@ 2000-08-25 03:31  Yury Don <yura@vpcit.ru>
  parent: Jackson Ching <jching@imvi.com.ph>
  1 sibling, 1 reply; 4+ messages in thread

From: Yury Don @ 2000-08-25 03:31 UTC (permalink / raw)
  To: pgsql-sql

Jackson Ching wrote:
> 
> Hi,
> 
>         I'm using JSDK 2.0 and IBM JDK 1.3 on RedHat Linux 6.2
> 
>         As i test my servlet,  I got errors saying count(*) column not found in a query like this
> 
>         SELECT COUNT(*) FROM MyTable
> 
>         in my rs.getint("COUNT(*)");   in oracle it works fine, in postgresql it doesn't. how should i handle aggregate functions in SQL then?
> 
>         Thanks
> 
> Jackson

What version of rostgres do you use?
SELECT COUNT(*) FROM MyTable works pretty well in postgres 6.5.1 and
later.
Perhaps problem is in java?

-- 
Sincerely yours,
Yury



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Getting the result of a query using COUNT(*)
@ 2000-08-25 03:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jackson Ching <jching@imvi.com.ph>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2000-08-25 03:57 UTC (permalink / raw)
  To: Jackson Ching <jching@imvi.com.ph>; +Cc: pgsql-general@postgresql.org

"Jackson Ching" <jching@imvi.com.ph> writes:
> 	SELECT COUNT(*) FROM MyTable

> 	in my rs.getint("COUNT(*)");

Offhand I'd guess that the returned column heading is "count" not
"COUNT(*)".  Use an AS clause if you want to be sure about the
column heading of a SELECT result...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Re: [GENERAL] Getting the result of a query using COUNT(*)
@ 2000-08-25 06:12  Alexandru COSTIN <acostin@rds.ro>
  parent: Yury Don <yura@vpcit.ru>
  0 siblings, 0 replies; 4+ messages in thread

From: Alexandru COSTIN @ 2000-08-25 06:12 UTC (permalink / raw)
  To: pgsql-sql

    Hello
    Try this way:
         SELECT COUNT(*) as no FROM MyTable
         rs.getint("no");
    Or
         SELECT COUNT(*) FROM MyTable
        rs.getInt(0); (or (1))
                    alexander


> Jackson Ching wrote:
> >
> > Hi,
> >
> >         I'm using JSDK 2.0 and IBM JDK 1.3 on RedHat Linux 6.2
> >
> >         As i test my servlet,  I got errors saying count(*) column not
found in a query like this
> >
> >         SELECT COUNT(*) FROM MyTable
> >
> >         in my rs.getint("COUNT(*)");   in oracle it works fine, in
postgresql it doesn't. how should i handle aggregate functions in SQL then?
> >
> >         Thanks
> >
> > Jackson
>
> What version of rostgres do you use?
> SELECT COUNT(*) FROM MyTable works pretty well in postgres 6.5.1 and
> later.
> Perhaps problem is in java?
>
> --
> Sincerely yours,
> Yury





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Getting the result of a query using COUNT(*)
@ 2000-08-25 16:37  Jackson Ching <jching@imvi.com.ph>
  0 siblings, 2 replies; 4+ messages in thread

From: Jackson Ching @ 2000-08-25 16:37 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

Hi,

	I'm using JSDK 2.0 and IBM JDK 1.3 on RedHat Linux 6.2

	As i test my servlet,  I got errors saying count(*) column not found in a query like this

	SELECT COUNT(*) FROM MyTable

	in my rs.getint("COUNT(*)");   in oracle it works fine, in postgresql it doesn't. how should i handle aggregate functions in SQL then?

	Thanks

Jackson




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2000-08-25 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-25 16:37 Getting the result of a query using COUNT(*) Jackson Ching <jching@imvi.com.ph>
2000-08-25 03:31 ` Yury Don <yura@vpcit.ru>
2000-08-25 06:12   ` Alexandru COSTIN <acostin@rds.ro>
2000-08-25 03:57 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox