title: template toolkit displays unique row
body: <p>I am using Perl dancer2 to write an application. Running select query in mysql displays all records. But the same query run in dancer2 and template toolkit displays only unique records.</p>
  
  <p>Eg. 34 records fetched when this is run in mysql client.</p>
  
  <pre><code>    select timing.time as Time,
             church.church_name as Church_Name, 
             church.church_address as Address, 
             language.language_name as Language, 
             denomination.denomination_name as Denomination, 
             city.city_name as City, 
             state.state_name as State, 
             country.country_name as Country 
        from church 
        join country on church.church_countryid=country_id 
        join state on church.church_stateid=state.state_id 
        join city on church.church_cityid=city.city_id 
        join church_mass_timing on church.church_id=church_mass_timing.church_id 
        join timing on church_mass_timing.time_id=timing.time_id 
        join language on church_mass_timing.language_id=language.language_id 
        join denomination on church.church_denominationid=denomination.denomination_id 
    order by church.church_name,
             timing.time;
  </code></pre>
  
  <p>Same query in Dancer with Template Toolkit returns 11 records.</p>
  
  <pre><code>get '/church_list' =&gt; sub {
  my $db = connect_db();
  my $sql='select timing.time as Time,
                  church.church_name as Church_Name, 
                  church.church_address as Address, 
                  language.language_name as Language, 
                  denomination.denomination_name as Denomination, 
                  city.city_name as City, 
                  state.state_name as State, 
                  country.country_name as Country 
             from church 
             join country on church.church_countryid=country_id 
             join state on church.church_stateid=state.state_id 
             join city on church.church_cityid=city.city_id 
             join church_mass_timing on church.church_id=church_mass_timing.church_id 
             join timing on church_mass_timing.time_id=timing.time_id 
             join language on church_mass_timing.language_id=language.language_id 
             join denomination on church.church_denominationid=denomination.denomination_id 
         order by church.church_name,
                  timing.time';
  my $sth = $db-&gt;prepare($sql) or die $db-&gt;errstr;
  $sth-&gt;execute or die $sth-&gt;errstr;
  template 'church_list.tt' =&gt; { 'title' =&gt; 'church list',
     'site' =&gt; 'Church Timings', 
     'entries' =&gt; $sth-&gt;fetchall_hashref('Time'),
  };
  };    
  </code></pre>
  
  <p>this is the church_list.tt</p>
  
  <pre><code>&lt;% INCLUDE header.tt %&gt;
  &lt;ul id="content"&gt;
  &lt;button id="btnExport"&gt;Export to xls&lt;/button&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;div id="table_wrapper"&gt;
  
  &lt;% IF entries.size %&gt;
  &lt;table border="1" cellspacing="2" widht="100%"&gt;
  &lt;tr&gt;
  &lt;th&gt;&lt;center&gt;Time&lt;/center&gt;&lt;/th&gt;
  &lt;th&gt;&lt;center&gt;Church name&lt;/center&gt;&lt;/th&gt;
  &lt;th&gt;&lt;center&gt;Address&lt;/center&gt;&lt;/th&gt;
  &lt;th&gt;&lt;center&gt;Language&lt;/center&gt;&lt;/th&gt;
  &lt;th&gt;&lt;center&gt;Denomination&lt;/center&gt;&lt;/th&gt;  
  &lt;th&gt;&lt;center&gt;City&lt;/center&gt;&lt;/th&gt;
  &lt;th&gt;&lt;center&gt;State&lt;/center&gt;&lt;/th&gt;
  &lt;th&gt;&lt;center&gt;Country&lt;/center&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;% FOREACH id IN entries.keys %&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;% entries.$id.Time %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.Church_Name %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.Address %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.language %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.denomination %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.city %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.state %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% entries.$id.country %&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;% END %&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;% ELSE %&gt;
  &lt;li&gt;&lt;em&gt;No entries here so far.&lt;/em&gt;
  &lt;% END %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Thanks.</p>