[Zope] ZCatalog: searching where on index == another index

Dieter Maurer dieter at handshake.de
Fri Oct 21 15:03:26 EDT 2005


Etienne Labuschagne wrote at 2005-10-21 13:00 +0200:
>Is there a way to search for all the records where one indexed field
>equals another indexed field?
>
>Equivalent SQL query would be:
>
>SELECT * FROM table WHERE field1 = field2

If the index has only a few different values,
enumerating them may be feasible.

With "AdvancedQuery", this could look like:

     from Products.AdvancedQuery import Or, Eq

     query = Or(*[Eq(I1,v) & Eq(I2,v) for v in I1.unique(Values)])

-- 
Dieter


More information about the Zope mailing list