[Zope-DB] Database Data
Thu, 22 May 2003 20:26:37 +0200
Lindstrom Greg - glinds wrote at 2003-5-21 12:31 -0500:
> I am using Zope 2.6, mySQL 3.23 with the eGenix myODBC DB adaptor (which I
> love!) on Windows 98 and have the following questions.
> 1. How can I retrieve data from a database query when I know there is only
> 1 row to be returned (for example, I have a "users" table)? Currently, I am
> using a <dtml-in...> loop and I feel a little silly.
The result behaves like a sequence.
You use subscription syntax to access the elements of a sequence,
like "seq", "seq", ....
Your concrete case might look like:
> 2. Can I use the <dtml-sqlgroup> with joins? For example
> SELECT n.name, a.city FROM Names n, Addresses a <dtml-sqlgroup
> <dtml-sqltest myKey col=n.myKey op=eq type=string>
> n.myKey = a.myKey
> I can't figure out how to do the n.myKey = a.myKey, and I will be
> doing a lot of joins.
It will work as you wrote it above.