| From: | "Niederland" <niederland(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Aggregate in Correlated SubQuery |
| Date: | 2006-10-15 07:30:42 |
| Message-ID: | 1160897442.025193.54970@b28g2000cwb.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Sorry working to late at night.... Query works just a typo
the following works.
WHERE
Lead.CreationDate = (SELECT MIN(LL.CreationDate) FROM Lead AS LL
WHERE LL.ProspectID = Lead.ProspectID)
sorry for the previous post,
Roger
Niederland wrote:
> Before postgresql 8.1.5, I could do the following to find the first
> lead that created a prospect in my application.
>
> SELECT
> Lead.LeadID,
> Prospect.ProspectID
> FROM
> Prospect INNER JOIN Lead USING (ProspectID)
> WHERE
> Lead.CreationDate = (SELECT MIN(Lead.CreationDate) FROM Lead AS LL
> WHERE LL.ProspectID = Lead.ProspectID)
>
> With 8.1.5 this now generates:
> ERROR: aggregates not allowed in WHERE clause
> SQL state: 42803
>
> Shouldn't aggregate functions still work within correlated subQueries?
> I saw in the 8.1.5 release notes that this was disabled due to crashes
> this caused in 8.1.X versions for Postgresql. I have never experienced
> this with queries similar to the above.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2006-10-15 09:39:20 | Re: BEGIN WORK READ ONLY; |
| Previous Message | Andrew - Supernews | 2006-10-15 07:29:52 | Re: Aggregate in Correlated SubQuery |