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