Re: [Zope] Substracting value from variable?
Jonathan <listsmurf@ur.nl> wrote:
Hi all, Is there a way to have a ZSQL Method select the four highest values from a list of values in a database? Example:
select distinct year from table
returns the following results
1975 1980 1985 1990 1995 2000
from which I want to select the latest four years:
1985 1990 1995 2000
Possible? Can't seem to find anything in the docs :(
This can be achieved with plain SQL, just alter your query like this: select distinct year from table order by year limit 4 that will do the trick. Maybe you need 'order by year desc' instead of just 'order by year' to get the four highest values not the for lowest, but i'm not sure, cheers, -- Arjan Scherpenisse acscherp@wins.uva.nl may the source be with you === http://www.gnu.org ===
participants (1)
-
Arjan Scherpenisse