pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masaru Sugawara <rk73@sea.plala.or.jp>
To: Sean McCorkle <mccorkle@avenger.bio.bnl.gov>
Cc: pgsql-sql@postgresql.org
Subject: Re: blanking out repeated columns in rows
Date: Thu, 09 May 2002 07:33:27 +0900
Message-ID: <20020509072256.4921.RK73@sea.plala.or.jp> (raw)
In-Reply-To: <20020509005131.4FF4.RK73@sea.plala.or.jp>
References: <20020507150350.GA24648@avenger.bio.bnl.gov>
	<20020509005131.4FF4.RK73@sea.plala.or.jp>

On Thu, 09 May 2002 01:51:59 +0900
Masaru Sugawara <rk73@sea.plala.or.jp> wrote:

> 
> How about this method of appending sequences as unique indices?
> 
> 
> First:
> create temp sequence dna_rownum1;
> create temp sequence dna_rownum2;
> 
> Secand:
> SELECT setval('dna_rownum1', 1, false);   -- (1)
> SELECT setval('dna_rownum2', 1, false);   -- (2)
> SELECT (CASE WHEN t1.idx = t3.idx THEN t1.tag ELSE NULL END) AS tag,


I'm sorry. This one is simpler.

SELECT (CASE WHEN t1.oid = t2.idx THEN t1.tag ELSE NULL END) AS tag,
               t1.gb_id,
               t1.pos,
               t1.descrip
  FROM  dna AS t1,
              (SELECT tag, MIN(oid) AS idx
                  FROM dna
                GROUP BY tag
              ) AS t2
 WHERE t1.tag = t2.tag
 ORDER BY t1.tag, t1.oid;  



Regards,
Masaru Sugawara





view thread (3+ messages)

Message-ID: <20020509072256.4921.RK73@sea.plala.or.jp>
Permalink:  ../20020509072256.4921.RK73@sea.plala.or.jp/
Also on:    postgresql.org/message-id/20020509072256.4921.RK73@sea.plala.or.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rk73@sea.plala.or.jp, mccorkle@avenger.bio.bnl.gov
  Subject: Re: blanking out repeated columns in rows
  In-Reply-To: <20020509072256.4921.RK73@sea.plala.or.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox