Re: Add last two values
- From: mcolson <mcolson1590@xxxxxxxxx>
- Date: Thu, 26 Jul 2007 19:43:10 -0000
On Jul 26, 2:21 pm, Jason Lepack <jlep...@xxxxxxxxx> wrote:
select
sum(box)
from (
select top 2
box
from
your_table
order by
id desc)
Cheers,
Jason Lepack
On Jul 26, 3:16 pm, mcolson <mcolson1...@xxxxxxxxx> wrote:
I am trying to create a stored procedure that will add the last two
entries from a column. If I had a column named box, I would want to
add the two values in box, for which my ID column is Max and Max-1.
Is there anyone who can help me with this?
Matt
so i should
SET box = select
sum(box)
from (
select top 2
box
from
batchdaa
order by
IDnum desc)
?
.
- Follow-Ups:
- Re: Add last two values
- From: mcolson
- Re: Add last two values
- References:
- Add last two values
- From: mcolson
- Re: Add last two values
- From: Jason Lepack
- Add last two values
- Prev by Date: Re: general question
- Next by Date: Set variable to value in column
- Previous by thread: Re: Add last two values
- Next by thread: Re: Add last two values
- Index(es):