Re: getting counts . .please help

From: Darren R <darrenr114(at)yahoo(dot)com>
To: Srinivas Iyyer <srini_iyyer_bio(at)yahoo(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: getting counts . .please help
Date: 2006-10-06 17:55:06
Message-ID: 20061006175507.17651.qmail@web54314.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'm thinking that you're asking from something along
these lines:

SELECT count(*)
FROM gob
WHERE gid IN
(SELECT gid FROM comb2
WHERE seq_id IS NOT NULL);

This will give you a count of gid instances in table
'gob' that are also in the table 'comb2' with at least
one seq_id assigned.

Sub-selects - gotta love 'em.

Hope this helps.

--- Srinivas Iyyer <srini_iyyer_bio(at)yahoo(dot)com> wrote:

> dear group,
>
> I have a table:
>
> Table: gob
>
> gid | goid | gon
> |gonms
>
-----+------------+----------------------------------+
>
> 2146 | GO:0000005 | ribosomal chaperone activity
> |
> MF
> 2147 | GO:0000006 | zinc uptake transporter activity
> |
> MF
> 2148 | GO:0000007 | zinc ion transporter activity
> |
> MF
>
>
> Table comb2:
> c2id | gid | seq_id
> --------+-------+--------
> 171912 | 4867 | 41087
> 171913 | 6844 | 54392
> 171914 | 3334 | 50007
> 171915 | 15562 | 38416
>
>
> seq_id | seq_refseq | seq_gname
> --------+--------------+-----------------
> 33014 | NM_025196 | GRPEL1
> 33015 | NM_007186 | CEP2
> 33016 | NM_018148 | LINS1
> 33017 | NM_199166 | ALAS1
> 33018 | NM_001029946 | C1orf178
>
>
> seq_id and gid are in bridge table com2.
>
>
> My question is :
>
> I want to take each entry from table gobe (gid) and
> count to how many seq_id is connected.
>
>
> could any one help me please.
>
> Thanks
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map
> settings
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message jorge alberto 2006-10-06 18:01:26 Re: Interface of the R-tree in order to work with postgresql
Previous Message Darren R 2006-10-06 15:51:16 Re: postgresql db account