[Zope] Using lists in DTML

Hannu Krosing hannu@tm.ee
Thu, 06 Apr 2000 00:55:47 +0300


Ken Kinder wrote:
> 
> Say I have two iterations like this:
> 
> <ul>
>   <dtml-in ..>
>     <li>..
>   </dtml-in>
>   <dtml-in ..>
>     <li>..
>   </dtml-in>
> </ul>
> 
> That use two different SQL queries, but return rows from the same
> table. Logically, to the user, these iterations render just one
> lists. How would I eliminate duplicates created by querying the
> same table?

Why not just use UNION at the SQL level and get just one list with 
duplicates already magically removed ?

so instead

select * from cats where catcolour='grey';

and 

select * from cats where legs >=3;

do

select * from cats where catcolour='grey'
union
select * from cats where legs >=3
order by name;

and use it in _one_ <dtml-in ...>

--------------
Hannu