From: Tom Lane <tgl@sss.pgh.pa.us>
To: Shaun <delius@progsoc.uts.edu.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: Failing query...
Date: Sat, 19 Aug 2000 17:34:25 -0400
Message-ID: <6992.966720865@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.21.0008191544490.2397-100000@ftoomsh.progsoc.uts.edu.au>
References: <Pine.LNX.4.21.0008191544490.2397-100000@ftoomsh.progsoc.uts.edu.au>
Shaun <delius@progsoc.uts.edu.au> writes:
> SELECT a.auction_id, a.user_id, c.other_names,
> c.surname, c.email, a.reserve, a.close_time, a.short_desc,
> a.long_desc, a.start_time,
> (COALESCE((select MAX(bid) from bid where auction_id = a.auction_id
> group by auction_id), 0)) as max_bid
> FROM Auction a, Customer c
> WHERE a.user_id = c.user_id
> AND a.auction_id = 754;
Sub-selects inside COALESCE don't work :-(. This was just fixed about a
week ago --- it will be in 7.1. In the meantime you might try it the
other way round:
(select COALESCE(MAX(bid), 0) from bid where auction_id = a.auction_id)
as max_bid
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, delius@progsoc.uts.edu.au
Subject: Re: Failing query...
In-Reply-To: <6992.966720865@sss.pgh.pa.us>
References: <Pine.LNX.4.21.0008191544490.2397-100000@ftoomsh.progsoc.uts.edu.au> <6992.966720865@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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