On Mon, 2006-05-29 at 12:32 +0200, Nis Jorgensen wrote:
> Rafal Pietrak wrote:
> > But is there a way to achieve one row output with both the count() and
> > its selector, when the ocunt is ZERO?
> SELECT dummy.id, count(xxx.id) FROM (SELECT :id as id FROM dual) as
> dummy LEFT JOIN xxx using (id)
Rafal Pietrak wrote:
On Sat, 2006-05-27 at 14:06 -0400, Bruce Momjian wrote:
Is this a feature, or a bug? And in fact, is there a construct to get
both the count() and its selectors *in*case*, when the count is ZERO?
All the above in postgres 8.1.
It is supposed to work that way. In the first
On Sat, 2006-05-27 at 11:51 -0700, Richard Broersma Jr wrote:
> select count(xxx.id) as cnt,
> xxx.id,
> xxx_grp.id as grpid,
> xxx_grp.grp
> fromxxx
> right join xxx_grp
> on (xxx.id = xxx_grp.id)
> group by xxx.id, grpid, xxx_grp.grp
> order by xxx_grp.id
Maybe this my work for you?
CREATE TABLE xxx (id int, info text);
create table xxx_grp ( id int, grp text);
insert INTO xxx_grp values ( 0, 'group0');
insert INTO xxx_grp values ( 1, 'group1');
insert INTO xxx_grp values ( 2, 'group2');
insert into xxx values ( 1, 'test1');
insert into xxx valve
On Sat, 2006-05-27 at 14:06 -0400, Bruce Momjian wrote:
> > Is this a feature, or a bug? And in fact, is there a construct to get
> > both the count() and its selectors *in*case*, when the count is ZERO?
> >
> > All the above in postgres 8.1.
>
> It is supposed to work that way. In the first que
Rafal Pietrak wrote:
> Hi All,
>
> This is ambarasing, but I've just noticed the following (which looks
> inconsistant to inexperienced eye). Having a table:
>
> test=> CREATE TABLE xxx (id int, info text);
>
> With some rows in it, I try:
>
> test=> SELECT count(1) from xxx where i