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

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

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...

--
- David T. Wilson
david(dot)t(dot)wilson(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-08-04 19:14:15 Re: is a 'pairwise' possible / feasible in SQL?
Previous Message Martin Gainty 2008-08-04 18:42:38 Re: Howto disable login?