From: | Adrian Johnson <oriolebaltimore(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Help with queries. |
Date: | 2010-09-21 11:57:59 |
Message-ID: | AANLkTi=zPe07+3VhiacYHUfcam_-QWRGbjVUfXeYLsY=@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Dear group,
I just started learning postgres and I have to analyze my data. So
please bear with me, for all the simple questions that I am asking.
Apologies.
I have a table:
snps table
id | sample_id | chromosome | from | to |
----------------------------------------------------------------
1 1 chr1 10 11
2 1 chr1 14 15
3 2 chr1 14 15
4 2 chr1 9 10
5 3 chr1 14 15
6 3 chr14 35 36
7 3 chr14 39 40
8 2 chr14 39 40
9 2 chr14 43 44
10 1 chr14 43 44
gene table:
id | chromosome | from | to | genename
1 chr1 4 20 SRC
2 chr1 25 45 SRC
3 chr1 80 100 CSK
4 chr1 120 140 CSK
My aim is to for a gene in gene table (SRC that has two ranges 4-20 and 25-45),
I want to map all coordinates in snps table.
Then I want to get those entries where sample 1 and sample 2 have in
common and sample 1 and sampl3 in common.
I do not know how to get these entries. Could any one help me please.
thank you.
adrian
From | Date | Subject | |
---|---|---|---|
Next Message | Gary Stainburn | 2010-09-21 12:25:55 | Slow response in select |
Previous Message | Oliveiros d'Azevedo Cristina | 2010-09-21 10:25:45 | Re: all the table values equal |