Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sql Help

Re: Sql Help

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 01 Aug 2005 16:23:34 -0700
Message-ID: <1122938597.105249@yasure>


Frank van Bortel wrote:

> DA Morgan wrote:
> 

>>kishanthakker_at_gmail.com wrote:
>>
>>
>>>Dear Prochak,
>>>
>>>
>>>
>>>>>How do you define the "previous row" ?
>>>
>>>
>>>
>>>I M selecting in order of fnd_code,txn_dt,txn_no
>>>
>>>and I want in the same order previous row.
>>>
>>>I hope I M clear in my explanation.
>>>
>>>thanx
>>>
>>>regards
>>>
>>>Kishan Thakker
>>
>>
>>There is no such thing in a relational database heap table
>>as previous. How can "previous" be determined based on application
>>logic. The table, itself, has no such concept.
> 
> 
> Daniel, cool down, have a sip.
> "I select, [and] order [on] fnd_code,txn_dt,txn_no".
> So when there's 1,2,2/1,2,3/1,3,1/1,3,3
> the "previous" record of 1,3,3 would be 1,3,1.
> the "previous" record of 1,3,1 would be 1,2,3, etc.
> 
> Now, the OP had something about running totals?

Had a whole glassfull. But perhaps "previous" means the previous insert? Maybe it is based upon a primary key, maybe it is based on the ORDER BY clause? There just is no concept of previous in Oracle unless your data has the ordering encoded.

I feel better now.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Mon Aug 01 2005 - 18:23:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US