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

Re: [INTERFACES] Problem using Having in a sub-query wit the Count function.

From: Ordini <sferac(at)bo(dot)nettuno(dot)it>
To: Matthew <matt(at)ctlno(dot)com>
Cc: "'pgsql-general(at)hub(dot)org'" <pgsql-general(at)hub(dot)org>, "'pgsql-interfaces(at)hub(dot)org'" <pgsql-interfaces(at)hub(dot)org>
Subject: Re: [INTERFACES] Problem using Having in a sub-query wit the Count function.
Date: 1999-03-24 13:25:06
Message-ID: 36F8E7B2.39310407@bo.nettuno.it (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-interfaces
bug: HAVING IN SUBQUERIES
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a known bug.
Jose'

> > We are trying to execute a query that has several sub-queries embedded
> > in it.  Below is a snippet of the sql code.
> >
> > "Select ordnum from ordinace where dept='Finance' and ordnum in
> > (Select ordnum from squareview where square='A') and ordnum in (select
> > ordnum from keywordview where keyword='Parade' or keyword='Public
> > Gathering' group by ordnum having count(ordnum) =2)"
> >
> > The two tables in the sub-queries (squareview and keywordview) or
> > views created between two tables.
> > There are roughly about 20000 records in the keywordview view.
> >
> > When we execute the query, failing at the keywordview subquery, saying
> > the aggregate function in the having clause must appear on the right
> > side. (?)  When we take the having clause out, and strictly have the
> > group by, it takes 30secs to 3mins. to return with the valid
> > recordset.
> >
> > The funny thing is, as a stand alone query on it's own, the
> > keywordview query works fine.  It's very quick and has no problem with
> > the having clause.
> >
> > I was wondering if anyone else has either had this problme using
> > aggregate functions with the having clause in a subquery, or could
> > anyone give me any information of successfully executing something
> > similar to this.
> >
> > Any infomation would be appreciated.
> >
> > Thanks in advance,
> >
> > Steve
> > steve(at)ctlno(dot)com


In response to

pgsql-interfaces by date

Next:From: Byron NikolaidisDate: 1999-03-24 14:24:28
Subject: Re: [INTERFACES] why there's only char type?
Previous:From: Eric MarsdenDate: 1999-03-24 09:48:42
Subject: [ANN] pg.el -- Emacs Lisp interface for PostgreSQL

pgsql-general by date

Next:From: Tom LaneDate: 1999-03-24 14:54:49
Subject: Re: [INTERFACES] Problem using Having in a sub-query wit the Count function.
Previous:From: Herouth MaozDate: 1999-03-24 13:14:39
Subject: Re: [GENERAL] COPY with default values won't work?

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