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

Поиск
Список
Период
Сортировка
Искать
От
Martin Knipper
Тема
Re: COUNT(*) to find records which have a certain number of
Дата
Msg-id
414F08FD.3080200@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 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>
Am 20.09.2004 18:19 schrieb T E Schmitz:

> 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'.
> 
> 

Try this:

select b.brand_name,m.model_name,count(*) from model m inner join
brand b on m.brand_fk=b.brand_pk inner join type t on
m.model_pk=t.model_fk where t.type_name='xyz' group by
b.brand_name,m.model_name having count(m.model_name)>0;

Greetings,

Martin

-- 
Martin Knipper
www  : http://www.mk-os.de
Mail : knipper@mk-os.de


В списке pgsql-sql по дате отправления
От: Michael Fuhr
Дата:
От: Mischa Sandberg
Дата:
FAQ