Posted by shiju on 08/01/07 03:29
On Aug 1, 2:45 am, mcolson <mcolson1...@gmail.com> wrote:
> I am trying to select multiple values from the row with the max id,
> and output them within my stored procedure. How would I combine the
> following two rows so that I only need to use "from mytable where
> IDnum = (select (max(IDnum)) from mytable))" once. I have at least 8
> other outputs I will be setting and would like this to work more
> efficiently than setting each individually... if possible.
>
> set @outmtd = (select outmtd from mytable where IDnum = (select
> (max(IDnum)) from mytable))
> set @outytd = (select outytd from mytable where IDnum = (select
> (max(IDnum)) from mytable))
>
> Thanks for any help you can give
>
> Matt
I think this is what looking
select @outytd=outytd,@outmtd=outmtd
from mytable where IDnum = (select
(max(IDnum)) from mytable)
[Back to original message]
|