I have just joined this list, so forgive me as I break my cardinal rule of reaidng a list for a while before posting. I am working on a banner ad rotation system for my Zope installation. To that end I am using a rather simple algorithm to determine which ad should be shown: Each time an ad is selected, ads not shown have their "notshown" count incremented by 2. An ad is selected whenever the number of impressions remaining PLUS its "notshown" is the largest in the DB. To that end I am trying to use the following query template to return the pointers to the ad to be displayed: select image, alt, id, imprem+notshown as fr from ads where imprem > 0 order by fr DESC LIMIT 1 As I quickly discovered the use of the '+' causes Zope to choke with a "keyError": Error, exceptions.KeyError: unhandled SQL used: select image, alt, id, imprem+notshown as fr from ads where imprem > 0 order by fr desc LIMIT 1 Traceback (innermost last): File /usr/local/www/Zope-2.0.0b5/lib/python/ZPublisher/Publish.py, line 209, in publish_module File /usr/local/www/Zope-2.0.0b5/lib/python/ZPublisher/Publish.py, line 179, in publish File /usr/local/www/Zope-2.0.0b5/lib/python/Zope/__init__.py, line 199, in zpublisher_exception_hook (Object: getad) File /usr/local/www/Zope-2.0.0b5/lib/python/ZPublisher/Publish.py, line 165, in publish File /usr/local/www/Zope-2.0.0b5/lib/python/ZPublisher/mapply.py, line 154, in mapply (Object: manage_test) File /usr/local/www/Zope-2.0.0b5/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: manage_test) File /usr/local/www/Zope-2.0.0b5/lib/python/Shared/DC/ZRDB/DA.py, line 310, in manage_test (Object: getad) File /usr/local/www/Zope-2.0.0b5/lib/python/Shared/DC/ZRDB/DA.py, line 291, in manage_test (Object: getad) File /usr/local/www/Zope-2.0.0b5/lib/python/Shared/DC/ZRDB/DA.py, line 395, in __call__ (Object: getad) File lib/python/Products/ZMySQLDA/db.py, line 191, in query KeyError: (see above) Is this a known problem? Have I done something incredibly stupid? I am able to use this syntax from the mysql monitor as well as in perl cripts. I have tried various combos of parens and escaping, to no avail. Thanks. -- Matt Miller matt.miller@thelinuxstore.com