[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] is there a way to pull out a max value in a database
> Tom asked...
> >[loop search=|
> > fi=my_database
> > rf=code
> > sf=code
> > se=maximum
> > |]
> >[loop-code]
> >[/loop]
> >
> >I want the maxium value to be displayed.
> >If the code field is from 0-100. it will only display
> >100
> >There is probably a simple way to do this but my brain
> >is not functioning properly right now. 8-)
> >
> >Thanks for any help,
> >Tom
> How about just setting the rows returned to 1? Set ml=1 in your
> search.
>
> John.
Yes, maybe ml=1, but to get the last record only... maybe try:
to=r,n
tf=sku
untested with the ml=1 command, but the idea is to sort on sku, and
reverse the order, and return one value.
If that doesn't work, try it without the ml=1, and kill the loop after
the first iteration.
If you are using a mysql database, I believe mysql has some function
built in for this.
HTH
Paul