Unix Technical Forum

getting counts . .please help

This is a discussion on getting counts . .please help within the pgsql Novice forums, part of the PostgreSQL category; --> dear group, I have a table: Table: gob gid | goid | gon |gonms -----+------------+----------------------------------+ 2146 | GO:0000005 | ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 11:14 PM
Srinivas Iyyer
 
Posts: n/a
Default getting counts . .please help

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 11:15 PM
Darren R
 
Posts: n/a
Default Re: getting counts . .please help

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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com