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 4157E11D.2030400@numerixtechnology.de
обсуждение исходный текст
Ответ на Re: COUNT(*) to find records which have a certain number of  (Martin Knipper <martin@mk-os.de>)
Список pgsql-sql
Hallo Martin,

Martin Knipper wrote:

> Am 20.09.2004 18:19 schrieb T E Schmitz:
> 
>>>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;
> 

Sorry, no, this doesn't work. It definitely doesn't return the required 
resultset. It just returns all BRAND_NAME,MODEL_NAME for all Models that 
have a Type with TYPE_NAME='xyz'.

-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz


В списке pgsql-sql по дате отправления:

Предыдущее
От: Devrim GUNDUZ
Дата:
Сообщение: Re: postgres rpm
Следующее
От: Greg Stark
Дата:
Сообщение: Re: COUNT(*) to find records which have a certain number of dependencies