[Zope] A single value from SQL

Oleg Broytmann phd2@earthling.net
Sat, 5 Jun 1999 21:04:23 +0400 (MSD)


On Sat, 5 Jun 1999, Rob Page wrote:
> I just tried this (and it worked!) with a simple Gadfly database:
> 
> SELECT * FROM employees 
> WHERE 
> age = 
> <!--#in sqlSelectOldestAge-->
> <!--#var oldest_age-->
> <!--#/in-->
> 
> where sqlSelectOldestAge:
> ----------------------------
> SELECT MAX(age) AS oldest_age FROM employees
> 
> --Rob

   This means than
<!--#var sqlSelectOldestAge--> is a list. If you know the list has excatly
1 element (SELECT MAX must return exactly 1 row) there should be a way to
extract first element off the list without #in loop. Something like
<!--#var "sqlSelectOldestAge()[0]" -->

Oleg.
---- 
    Oleg Broytmann     http://members.xoom.com/phd2/     phd2@earthling.net
           Programmers don't die, they just GOSUB without RETURN.