Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Sql Help
kishanthakker_at_gmail.com wrote:
> I have a very specific problem with oracle 8.0.4.
>
> i have following view
> cum_fifo_figures
> (
> fnd_code varchar2(8),
> txn_dt date,
> txn_no number(3),
> cum_unt number(7),
> cum_amt number(7)
> )
>
> its in order of fnd_code,txn_dt,txn_no
>
> I want to select value of cum_amt of previous row
> while selecting fnd_code,txn_dt,txn_no.
>
> note : in case of first row it should select value from current row.
>
> can anybody help me Please......
>
> Kishan Thakker
How do you define the "previous row" ?
I have an idea based on txn_dt, but are you looking also for the previous fnd_code? previous txn_no?
your requirements aren't clear, so likely that is your problem. (most of the work in solving a problem lies in figuring out how to phrase the question).
Let us know the details and maybe we can help. I envision something with s self join
SELECT ...
FROM cum_fifo_figures cff1, cum_fifo_figures cff2
WHERE cff1....
Again, let us know.
Ed Received on Fri Jul 29 2005 - 07:19:52 CDT