jcropp
17th December 2008, 23:30
People,
This is a very rookie question but I have gone brain dead. I want to select the max record from a table that contains an item number and a sequence number. What clause can I use in the select statement?
Thanks,
zardoz
18th December 2008, 10:08
Just order in descending and get only one record, like this:
Select table.*
from table
where <condition>
order by <sequence> desc
as set with 1 rows
prashant
18th December 2008, 10:12
hi,you can use
"as set with 1 rows" with "order by" clause.
hope this will help you
zardoz
18th December 2008, 12:14
Prashant, why you always duplicate my answers? Isn't useful...
_Ralph_
18th December 2008, 14:44
owowo:eek:
mark_h
18th December 2008, 16:20
Prashant, why you always duplicate my answers? Isn't useful...
Look at the post times....in this case the answers were minutes apart. So he might looked at the post for a few more minutes before providing his reply. Sometimes I bring up a post, get interupted, then respond - which provides an opportunity for someone else to have posted the same answer. And sometimes the wording between the two answers are different and one has a better explanation than the other.
zardoz
18th December 2008, 16:31
My comment was also referred to this other link:
http://www.baanboard.com/baanboard/showthread.php?t=54467
But if this isn't a problem for the forum isn't a problem also for me...
prashant
19th December 2008, 07:53
Hi ZARDOZ,
It was not at all my intensions to duplicate your answer.
And like MARK_H has mentioned...it was just a matter of few minutes.Before that there was no Reply when i started Posting.
But still i apologies.
Thanks
Regards
jcropp
19th December 2008, 21:02
thank you for your help.. all. It really helped refresh my memory as I have been out of the BaaN camp for a while working on other systems. It really doesn't matter if the answer is duplicated, so long as it is answered. I appreciate knowing that I am not alone.
edjofego
23rd December 2008, 02:00
Hi jcropp
Also you can try with this one:
select max(field):host_variable(optional)
from table
where <condition>
order by <clause>
selectdo
endselect
Greetings :D
zardoz
23rd December 2008, 12:11
edjofrego, your solution doesn't extract the record but only the max value.