[Zope] Substracting value from variable?
Satheesh Babu
vsbabu@csoft.net
Tue, 1 Aug 2000 13:27:43 -0400
If your database doesn't support LIMIT sql clause (like Oracle)
or if you don't want complexity in SQL, you can do it in dtml
like
<dtml-in my_query>
<dtml-if "_['sequence-number'] <=4 ">
<dtml-var year>
</dtml-if>
</dtml-in>
How ever, this assumes that the list of years are ordered properly
within the SQL. Also, this is good *ONLY* for queries that
return small number of data. You should not use this to pick
4 rows out of 10000 rows returned :-)
----- Original Message -----
From: Jonathan <listsmurf@ur.nl>
To: <zope@zope.org>
Sent: Tuesday, August 01, 2000 10:43 AM
Subject: [Zope] Substracting value from variable?
> 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 :(
>
> Thnx,
> Jonathan
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> 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 )
>
>