[Zope] ZSQL subselect P
Lee Marzke
lmarzke@kns.com
Tue, 13 Mar 2001 19:17:00 -0500 (EST)
On 13-Mar-01 Jim Penny wrote:
> On Tue, Mar 13, 2001 at 03:14:00PM -0700, Casey Duncan wrote:
>> 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
>> >
>
> I guarantee that (some) subselects can be done with this combo of software,
> use them all the time. I am a bit concerned about the LIMIT clause in
> a subselect.
>
> Would it not be far easier to say
>
> SELECT * FROM return WHERE requestid = ( SELECT min(requestid) FROM return)
> ?
That works !
>>I'm no MySQL expert, but generally you would use the IN operator when
>>doing subselects. Can MySQL even do subselects??
Yes, I just switched ( rather painlessly ) from MySQL to PostgreSQL
because of random flackness with Solaris-7, Zope-2.3.0, and the MysqlDB
products. The new PostgreSQL book by Momjian, ( Addison Wessley )
is great.
Lee Marzke <lmarzke@kns.com> 13-Mar-01, 19:10:36
Kulicke & Soffa Industries
2101 Blair Mill Rd +1 215 784-6217
Willow Grove, PA 19090 +1 215 784-6014 fax