Re: Using Rownum

From: KC Cheng <gogcheng_at_hotmail.com>
Date: Thu, 24 Jan 2002 11:26:43 +0800
Message-ID: <a2nupk$d2s49_at_imsp212.netvigator.com>


Rownum in query is used to indicate the display sequence of the result. It is not linking to the record. Try to use the key instead.

KC

"Rune Bjerke" <runbjerk_at_online.no> wrote in message news:ad2d9a7.0201211430.3ee970a4_at_posting.google.com...
> I have read a lot about rownum and can't find a good solution to
> update a table. The problem is this:
>
> - I want to update a table with three fact columns, the source table
> has the fact information stored in rows "identified" by a key field.
>
> table a
> ID
> fact
>
> ex: id1,fact1
> id2,fact1
> id2,fact2
> id3,fact1
> id3,fact2
> id3,fact3
> etc.
>
> table b
> ID
> fact1
> fact2
> fact3
>
> What I thought was to use rownum, but found out that you can't use
> rownum=2 etc.
>
> After some testing I tried to use a update statement like this
>
> update b set fact1 =
> (select fact from (select rownum rnum,fact from a where a.id=b.id)
> where rnum=2)
>
> then I get wrong column.
>
> How could I solve this?
>
> Regards
> Rune
Received on Thu Jan 24 2002 - 04:26:43 CET

Original text of this message