getting counts . .please help

Поиск
Список
Период
Сортировка
Искать

getting counts . .please help

От:
Srinivas Iyyer <srini_iyyer_bio@yahoo.com>
Дата:
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 

Re: getting counts . .please help

От:
Darren R <darrenr114@yahoo.com>
Дата:
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  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 
FAQ