Re: count(1) return 0?
От
Bill Moran
Тема
Re: count(1) return 0?
Дата
Msg-id
40428BB0.2050407@potentialtech.com
Ответ на
Re: count(1) return 0? (Zak McGregor)
Список
Дерево обсуждения
count(1) return 0? Zak McGregor <zak@mighty.co.za>
Re: count(1) return 0? Bill Moran <wmoran@potentialtech.com>
Re: count(1) return 0? Zak McGregor <zak@mighty.co.za>
Re: count(1) return 0? "Uwe C. Schroeder" <uwe@oss4u.com>
Re: count(1) return 0? Bill Moran <wmoran@potentialtech.com>
Re: count(1) return 0? Klint Gore <kg@kgb.une.edu.au>
Re: count(1) return 0? Zak McGregor <zak@mighty.co.za>
Re: count(1) return 0? Klint Gore <kg@kgb.une.edu.au>
Re: count(1) return 0? Zak McGregor <zak@mighty.co.za>
Re: count(1) return 0? Greg Stark <gsstark@mit.edu>
Re: count(1) return 0? Kris Jurka <books@ejurka.com>
Zak McGregor wrote: > On Sun, 29 Feb 2004 19:55:15 -0500 > Bill Moran 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. I suspect that I still don't understand what you're trying to do, but ... select case when count(*) > 0 then 1 else 0 end from ... Was what I should have suggested. -- Bill Moran Potential Technologies http://www.potentialtech.com
В списке pgsql-general по дате отправления
От: Stephen Howard
Дата: