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,

cheers,

-- 
Arjan Scherpenisse
[EMAIL PROTECTED]

may the source be with you
=== http://www.gnu.org ===

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to