From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Shaun <delius(at)progsoc(dot)uts(dot)edu(dot)au> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Failing query... |
Date: | 2000-08-19 21:34:25 |
Message-ID: | 6992.966720865@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Shaun <delius(at)progsoc(dot)uts(dot)edu(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-08-19 21:38:11 | Re: Tuple size limit. |
Previous Message | David Lloyd-Jones | 2000-08-19 12:14:16 | Re: [SQL] database design and diagraming book recommendations.. |