I'm using the DBI plugin to generate a series of tourdates grouped by
tours:

[% FOREACH tour = DBI.query( "SELECT * FROM tour_name ORDER BY tour_name_id DESC" ) %]
[% tour.tour_name_id %] : [% tour.tour_name %]
[% END %]

Produces the expected:

<H3>3 : <A NAME="Purple">Deep Purple UK Tour, 2002</A></H3>
<H3>2 : <A NAME="york">"An evening with Ian Paice and Pete York"</A></H3>
<H3>1 : <A NAME="dregs">Dixie Dregs (featuring Steve Morse) US tour</A></H3>

However, if I nest this:


[% FOREACH tour = DBI.query( "SELECT * FROM tour_name ORDER BY tour_name_id DESC" ) %]
<H3>[% tour.tour_name_id %] : [% tour.tour_name %]</H3>

[% tdi = tour.tour_name_id %]
[% FOREACH td =  DBI.query( "SELECT * FROM tour_date WHERE tour_date.tour_name_id = 
$tdi ORDER BY tourdate ASC")%]
[% td.tourdate %]
[% END %]
[% END %]

I end up with only _two_ sets:


<H3>3 : <A NAME="Purple">Deep Purple UK Tour, 2002</A></H3>

2002-02-06
2002-02-07

<H3>2 : <A NAME="york">"An evening with Ian Paice and Pete York"</A></H3>

2001-12-02
2001-12-03

Is the first result set getting crapped on? Any alternative
approaches?


Tia,

Dave



Reply via email to