[Zope] A single value from SQL

Daniel M. Drucker dmd@3e.org
Sat, 5 Jun 1999 11:52:01 -0400 (EDT)


(Yes, I'm asking a lot of questions. Hopefully the answers to the more
interesting ones can eventually make their way into documentation...)

I want to do something like this pseudo_sql_method:

select * from some_table where some_column = <!--#sqlvar
other_sql_method type=int-->


other_sql_method looks like this:
select max(some_column) from another_table


The point being that other_sql_method is guaranteed to return a single
value. I want to take that single value and directly interpolate it
into the text of pseudo_sql_method.

What I'm really trying to do here is:

select * from some_table where some_column = (select max(some_column)
from another_table)

but MySQL doesn't support nested selects (yet).

I'm quite confident there's a way to do this -- I was reading about
direct traversal -- but I can't quite grasp it.

Daniel Drucker