If you have a list of scores that is in the same order as the student list (either by doing a joined query, or some other method), you can then access the appropriate item in the scores list while looping through the students by doing <dtml-var "scores_list[_['sequence-index']]">, which will return the appropriate entry from the list. That should be enough to devise a solution that works for you. Alternatively, you may just have to call the insert query many times, in a dtml-in loop. In that case, just use the dtml-let code that I sent you earlier. --sam Jorge Magalhaes wrote:
You can actually nest ZSQL methods in a couple of ways. First of al, I sometimes find it easiest to use a dtml-let to set up the namespace for the second query, when doing what you are doing eg:
<dtml-in qry1> <dtml-let value1=var1 value2=var2> <dtml-in qry2> ... </dtml-in> </dtml-let> </dtml-in
This has always worked for me. There should be know need to pass parameters in explicitly, since dtml-let should put them in the namespace.
HOWEVER, depending on your needs, this is sometime easier.
ZSQLMethod # 1 (id is qry1)
SELECT (value1, value2) from table1
ZSQLMethod # 2 (id is qry2)
INSERT INTO table2 values <dtml-in qry1> <dtml-unless sequence-start>,</dtml-unless> (<dtml-var value1>, <dtml-var value2>) </dtml-in>
I see (value1=student_id, value2=score ). The value1 coming from the qry1 (OK) but in the qry2 i need to insert for each value1 a new value2. I think that a need do some modifications. I have tried to substitue
<dtml-var value2> for <dtml-sqlvar SCORE type=int> but the qry2 inserting the same value2 for each value1.
Thanks
jorge.
Notice that I am calling the first query directly from the second query, which is about as close to nested SELECT statements as you can get in MySQL.
--sam
_______________________________________________ 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 )