Re: find position of row in set of rows

From: Mark D Powell <Mark.Powell2_at_hp.com>
Date: Thu, 28 Jan 2010 11:04:15 -0800 (PST)
Message-ID: <96b78675-00df-4cc2-8cd6-92883511bb20_at_r19g2000yqb.googlegroups.com>



On Jan 28, 1:49 pm, cate <catebekens..._at_yahoo.com> wrote:
> I have a table ordered by date.  When I find a specific record in this
> set, I want to know what its position is in this ordered list.
>
> I could get the date from the record found and count dates above or
> below, but is there a better way?
>
> Thank you.

Look up the rownum psuedo column in your SQL manual.

Basically select rownum, date_col from ( select date_code from t order by 1 )

HTH -- Mark D Powell -- Received on Thu Jan 28 2010 - 13:04:15 CST

Original text of this message