Re: count(1) return 0?

Поиск
Список
Период
Сортировка
От Zak McGregor
Тема Re: count(1) return 0?
Дата
Msg-id 20040301030229.5bbf6565.zak@mighty.co.za
обсуждение исходный текст
Ответ на Re: count(1) return 0?  (Bill Moran <wmoran@potentialtech.com>)
Ответы Re: count(1) return 0?  (Bill Moran <wmoran@potentialtech.com>)
Re: count(1) return 0?  ("Uwe C. Schroeder" <uwe@oss4u.com>)
Список pgsql-general
On Sun, 29 Feb 2004 19:55:15 -0500
Bill Moran <wmoran@potentialtech.com> wrote:

> Not really sure I understand what you want, but try something like this:
>
> select case when count(*) > 0 then ''t'' else ''f'' end from ...

Unfortunately that does not work. When the resultset contains no records
whatsoever, I get no rows at all - so on case...else sort of expression within
the select itself will work.

What I am looking for is a way to select "0" if no rows are returned, or the
total number of rows returned from the query otherwise.

Thanks anyways though.

Ciao

Zak

--
========================================================================
http://www.carfolio.com/        Searchable database of 10 000+ car specs
========================================================================

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

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