Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 4, 2008 at 1:02 PM, David Wilson <david.t.wilson@xxxxxxxxx> wrote:
> On Mon, Aug 4, 2008 at 2:08 PM, Rajarshi Guha <rguha@xxxxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux