Jonathan  <[EMAIL PROTECTED]> 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,


Arjan Scherpenisse

may the source be with you
=== ===

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to