This is my 2 cents. Maybe there's better way to do this:
select
id,
amount,
(select amount from tablename where id=t.id and sno < t.sno limit 1)
as oldAmount
from tablename t
br
Radzi.
On 14-Jan-2008, at 8:14 PM, Vishal Mailinglist wrote:
Hi
sno | id | amount
1
Hi
>
> >> sno | id | amount
> >>> 1| 1 | 200
> >>> 2| 1 | 300
> >>> 3 | 2 | 100
> >>> 4 | 2 | 100
> >>> 5 | 1 | 500
> >>>
> >>> how could I subtract the sno 1 id 1 and sno 2 id 1 amount .
> >>
> >> select
> >> (select amount from tableName where sno=1 and id=1) -
> >> (select
Vishal Mailinglist wrote:
Hi ,
I knew I was not explaining better.
sno | id | amount
1| 1 | 200
2| 1 | 300
3 | 2 | 100
4 | 2 | 100
5 | 1 | 500
how could I subtract the sno 1 id 1 and sno 2 id 1 amount .
select
(select amount from tableName where sno=1 and id=1) -
3 matches
Mail list logo