Re: is a 'pairwise' possible / feasible in SQL?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>
Cc: "Rajarshi Guha" <rguha(at)indiana(dot)edu>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: is a 'pairwise' possible / feasible in SQL?
Date: 2008-08-04 19:14:15
Message-ID: dcc563d10808041214g45078549w28079dfb845c795b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 4, 2008 at 1:02 PM, David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com> wrote:
> On Mon, Aug 4, 2008 at 2:08 PM, Rajarshi Guha <rguha(at)indiana(dot)edu> wrote:
>
>> select count(aid) where cid = 123 and cid = 456;
>>
>> but I was wondering whether I could construct a single SQL statement to do
>> this.
>>
>> Any pointers would be appreciated,
>
> Typed into gmail, so may need some tweaking, but something to the effect of:
>
> select count(*) from table a inner join table b on a.aid=b.bid group
> by a.cid,b.cid;
>
> should do the trick, I'd think...

But then you need remove the dups where you got:

667 999 2
999 667 2

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Adams 2008-08-04 20:06:41 Re: recovery via base + WAL replay failure
Previous Message David Wilson 2008-08-04 19:02:09 Re: is a 'pairwise' possible / feasible in SQL?