From: T E Schmitz <mailreg@numerixtechnology.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: tricky GROUP BY / JOIN question
Date: Tue, 09 Nov 2004 14:46:02 +0000
Message-ID: <4190D82A.6040102@numerixtechnology.de> (raw)
In-Reply-To: <22995.1099852316@sss.pgh.pa.us>
References: <418DF96C.4090501@numerixtechnology.de>
<22995.1099852316@sss.pgh.pa.us>
Hello Tom,
Tom Lane wrote:
> T E Schmitz <mailreg@numerixtechnology.de> writes:
>
>>This is *almost* what I need:
>
>
>>SELECT
>>BRAND.BRAND_NAME,
>>MODEL.MODEL_NAME,
>>min (ITEM.PRICE),max (ITEM.PRICE)
>>*min (CONDITION.POSITION),max (CONDITION.POSITION)*
>>FROM ITEM
>>left outer join MODEL on MODEL_PK =ITEM.MODEL_FK
>>left outer join BRAND on BRAND.BRAND_PK =MODEL.BRAND_FK
>>left outer join CONDITION on CONDITION.CONDITION_PK = ITEM.CONDITION_FK
>>group by BRAND.BRAND_NAME,MODEL.MODEL_NAME
>
>
>>In the result I don't want min/max(POSITION) but CONDITION.NAME of min
>>and max(POSITION) for each MODEL.
>
>
> <snip>
> (select name from condition c1 where position = min(condition.position)),
> (select name from condition c2 where position = max(condition.position)),
> <snip>
Thank you, Tom, this worked a treat!
--
Regards/Gruß,
Tarlika Elisabeth Schmitz
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mailreg@numerixtechnology.de, tgl@sss.pgh.pa.us
Subject: Re: tricky GROUP BY / JOIN question
In-Reply-To: <4190D82A.6040102@numerixtechnology.de>
* 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