Re: blanking out repeated columns in rows

From: Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp>
To: Sean McCorkle <mccorkle(at)avenger(dot)bio(dot)bnl(dot)gov>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: blanking out repeated columns in rows
Date: 2002-05-08 22:33:27
Message-ID: 20020509072256.4921.RK73@sea.plala.or.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 09 May 2002 01:51:59 +0900
Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Barwick 2002-05-08 23:13:22 Re: having trouble w/ having clause...
Previous Message Jean-Luc Lachance 2002-05-08 21:47:55 Re: Performance on update from join