Lee Marzke wrote:
Hi,
I'm trying to use a subquery with the following SQL syntax and get an error.
SELECT * from return WHERE requestid = ( SELECT requestid from return ORDER BY requestid LIMIT 1 )
Each part of the queary works seperatly but not together. Are their limitation on SQL statements that are allowed ?
Using Zope 2.3.0 and PostgresSQL 7.0.3 ZPoPyDA-1.2.tar.gz PoPy-2.0.2.tar.gz
Trace follows: ================================================
Error, PoPy.ProgrammingError: ERROR: parser: parse error at or near "order"
SQL used:
SELECT * from return WHERE requestid=( SELECT requestid from return ORDER BY requestid LIMIT 1 )
Traceback (innermost last): File /sw/scm/usr/var/Zope230/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /sw/scm/usr/var/Zope230/lib/python/ZPublisher/Publish.py, line 187, in publish File /sw/scm/usr/var/Zope230/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: top_1) File /sw/scm/usr/var/Zope230/lib/python/ZPublisher/Publish.py, line 171, in publish File /sw/scm/usr/var/Zope230/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_test) File /sw/scm/usr/var/Zope230/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_test) File /sw/scm/usr/var/Zope230/lib/python/Shared/DC/ZRDB/DA.py, line 396, in manage_test (Object: top_1) File /sw/scm/usr/var/Zope230/lib/python/Shared/DC/ZRDB/DA.py, line 374, in manage_test (Object: top_1) File /sw/scm/usr/var/Zope230/lib/python/Shared/DC/ZRDB/DA.py, line 489, in __call__ (Object: top_1) File /sw/scm/usr/var/Zope230/lib/python/Products/ZPoPyDA/PoPy_db.py, line 95, in query ProgrammingError: (see above)
Sorry, I wrongly thought you were using MySQL for some odd reason. Anyhow, I'm a little confused as to what this SQL statement is trying to do. Please explain a bit, it isn't apparent to me from your example SQL code. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>