Re: count(1) return 0?

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: count(1) return 0?
Дата
Msg-id 404289F3.7020102@potentialtech.com
обсуждение исходный текст
Ответ на count(1) return 0?  (Zak McGregor <zak@mighty.co.za>)
Ответы Re: count(1) return 0?  (Zak McGregor <zak@mighty.co.za>)
Список pgsql-general
Zak McGregor wrote:
> Hi all
>
> is it possible to get a count(1) statemment, for example here:
>
> select count(1) from results where fixture=4916 and winner=away group by winner;
>
> to return a 0 value instead of absolutely nothing if no rows match fixture=4916
> and winner=away? I get absolutely no results at all.
>
>
> select count(1) from results where fixture=4916 and winner=home group by winner;
>  count
> -------
> (0 rows)
>
> any ideas please?

Not really sure I understand what you want, but try something like this:

select case when count(*) > 0 then ''t'' else ''f'' end from ...

--
Bill Moran
Potential Technologies
http://www.potentialtech.com


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

Предыдущее
От: Zak McGregor
Дата:
Сообщение: count(1) return 0?
Следующее
От: Zak McGregor
Дата:
Сообщение: Re: count(1) return 0?