Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A5DA3133740B for ; Tue, 21 Sep 2010 13:12:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 37948-10 for ; Tue, 21 Sep 2010 16:11:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by mail.postgresql.org (Postfix) with ESMTP id 5B36E133729E for ; Tue, 21 Sep 2010 13:11:53 -0300 (ADT) Received: from Proteu (proteu.marktest.pt [10.61.90.54]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id SBPTZ0P7; Tue, 21 Sep 2010 17:11:51 +0100 Message-ID: <13622609C3E64F38B9187B90F12F3049@marktestcr.marktest.pt> From: "Oliveiros d'Azevedo Cristina" To: "Adrian Johnson" , References: Subject: Re: Help with queries. Date: Tue, 21 Sep 2010 17:11:51 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.471 tagged_above=-5 required=5 tests=BAYES_00=-1.9, STOX_REPLY_TYPE=0.439, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/72 X-Sequence-Number: 34603 Howdy, Adrian, Please see my questions below > 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. Please advice me, What do you call coordinates to, exactly? Sorry, my genetics knowledge is very poor. You call the from and to fields coordinates? Do they have the same meaning as the from and to fields from table snps ? What does it mean to map all coordinates in table snps? Do you wanna know which entries from snps map in the SRC gene? Coordinates are the segment where the gene/sample fit in the chromosome? Is my understanding correct ? > Then I want to get those entries where sample 1 and sample 2 have in > common and sample 1 and sampl3 in common. > Could you give an example of your desired output, for the data you have ? > > I do not know how to get these entries. Could any one help me please. > > thank you. > > adrian > Best, Oliver > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql