Forum OpenACS Q&A: Response to Nested multiple tags

Collapse
Posted by Lars Pind on
Hi Guan,

No, you can't do what you're suggesting. There can still only be one instance of a multirow with a given anme (in this case 'emails'), so each time you loop over rows in the first db_multirow, you'd be overwriting the inner multirow with the new value.

But looking at the *contents* of your example, what you want to do is probably this:

db_multirow -extend { emails } people people {
    select person_id, first_names, last_name
    from persons
} {
    db_1row email {
        select email
        from email_addresses
        where person_id = :person_id
    }
}
This would work, as would
db_multirow -extend { emails } people people {
    select person_id, first_names, last_name
    from persons
} {
    set email [db_string email {
        select email
        from email_addresses
        where person_id = :person_id
    }]
}
/Lars