Re: COUNT(*) to find records which have a certain number of

Поиск
Список
Период
Сортировка
Искать
От
T E Schmitz
Тема
Re: COUNT(*) to find records which have a certain number of
Дата
Msg-id
414F02FF.8000603@numerixtechnology.de
Список
Дерево обсуждения
Re: COUNT(*) to find records which have a certain number of T E Schmitz <mailreg@numerixtechnology.de>
Re: COUNT(*) to find records which have a certain number of Rod Taylor <pg@rbt.ca>
Re: COUNT(*) to find records which have a certain number of T E Schmitz <mailreg@numerixtechnology.de>
Re: COUNT(*) to find records which have a certain number of Martin Knipper <martin@mk-os.de>
Re: COUNT(*) to find records which have a certain number of T E Schmitz <mailreg@numerixtechnology.de>
Re: COUNT(*) to find records which have a certain number of Greg Stark <gsstark@mit.edu>
JOIN performance "Dean Gibson (DB Administrator)" <postgresql3@ultimeth.com>
Re: JOIN performance Tom Lane <tgl@sss.pgh.pa.us>
Re: JOIN performance "Dean Gibson (DB Administrator)" <postgresql3@ultimeth.com>
Re: JOIN performance Tom Lane <tgl@sss.pgh.pa.us>
Re: JOIN performance "Dean Gibson (DB Administrator)" <postgresql3@ultimeth.com>
Re: JOIN performance Tom Lane <tgl@sss.pgh.pa.us>
Re: JOIN performance "Dean Gibson (DB Administrator)" <postgresql3@ultimeth.com>
Re: JOIN performance Tom Lane <tgl@sss.pgh.pa.us>
Re: JOIN performance "Dean Gibson (DB Administrator)" <postgresql3@ultimeth.com>
Is NULLIF nullable? "Dean Gibson (DB Administrator)" <postgresql4@ultimeth.com>
Re: Is NULLIF nullable? "Dean Gibson (DB Administrator)" <postgresql4@ultimeth.com>
Re: JOIN performance Chester Kustarz <chester@arbor.net>
Re: JOIN performance Greg Stark <gsstark@mit.edu>

I figured it eventually. (The only thing I don't know is where to put
the ORDER BY.)

> I want to select only those BRAND/MODEL combinations, where the MODEL 
> has more than one TYPE, but only where one of those has TYPE_NAME='xyz'.
> I am not interested in MODELs with multiple TYPEs where none of them are 
> called 'xyz'.

SELECT
BRAND_NAME,MODEL_NAME
FROM TYPE
left outer join MODEL  on MODEL_PK =TYPE.MODEL_FK
left outer join BRAND  on BRAND_PK =MODEL.BRAND_FK
group by BRAND.BRAND_NAME,MODEL_NAME
having count(*)>1

intersect

SELECT
BRAND_NAME,MODEL.MODEL_NAME
FROM TYPE
left outer join MODEL  on MODEL_PK =TYPE.MODEL_FK
left outer join BRAND  on BRAND_PK =MODEL.BRAND_FK
where TYPE_NAME='xyz'
group by BRAND.BRAND_NAME,MODEL_NAME


-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz



-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz

В списке pgsql-sql по дате отправления
От: T E Schmitz
Дата:
От: Josh Berkus
Дата:
Сообщение: Re: Test for file exists?
FAQ