Terry
Haven't tried this out yet, so take with a pinch of salt, but you may want:
q SELECT * FROM tester WHERE id IN (SELECT id FROM tester WHERE code < 5);
"=", rather than "IN" expects a single value (which is what the rather
cryptic error message probably ought to say).
Regards
Peter Hearty
Lutris Technologies UK Ltd.
-----Original Message-----
From: Terry Steichen <terry@net-frame.com>
To: Peter Hearty <peter.hearty@lutris.com>
Date: 20 June 2000 16:43
Subject: Re[3]: Subquery support?
>Peter,
>
>I made some additional progress with the following line in the attachement
I
>provided to you in my earlier message:
>
>q SELECT * FROM tester WHERE id=(SELECT id FROM tester WHERE code < 5);
>
>However, IDB still generated an error on this - here's the screen response
>from running test2.txt with that new query:
>
>Enhydra InstantDB - Version 3.13
>The Initial Developer of the Original Code is Lutris Technologies Inc.
>Portions created by Lutris are Copyright (C) 1997-2000 Lutris Technologies,
>Inc.
>
>All Rights Reserved.
>
>Connected to jdbc:idb:sample.prp
>Driver InstantDB JDBC Driver
>Version Version 3.13
>
>test3.txt DROP TABLE tester
>test3.txt CREATE TABLE tester ( id int PRIMARY KEY,
> fullName
>CHAR(30),
> code
> int )
>test3.txt INSERT INTO tester VALUES (1,"Alice",4)
>test3.txt INSERT INTO tester VALUES (2,"Joe",3)
>test3.txt INSERT INTO tester VALUES (3,"Paul",4)
>test3.txt INSERT INTO tester VALUES (4,"Dyane",4)
>test3.txt INSERT INTO tester VALUES (5,"Sammy",5)
>test3.txt SELECT * FROM tester WHERE id=(SELECT id FROM tester WHERE code <
>5)
>
>test3.txt java.sql.SQLException: Row count=4 col count=2 in comparison
>sub-query
>
>java.sql.SQLException: Row count=4 col count=2 in comparison sub-query
> at db.SQLProg.execute(SQLProg.java:275)
> at jdbc.idbStatement.execute(Compiled Code)
> at jdbc.idbStatement.executeQuery(idbStatement.java:91)
> at SampleThread.run(Compiled Code)
> at java.lang.Thread.run(Thread.java:479)
>
>
>
>----- Original Message -----
>From: Terry Steichen <terry@net-frame.com>
>To: Peter Hearty <peter.hearty@lutris.com>
>Sent: Tuesday, June 20, 2000 10:15 AM
>Subject: Re[2]: Subquery support?
>
>
>> Peter,
>>
>> Thanks for the reply. Glad to know about subquery support. Attached is
a
>> simple script. I know I'm doing something really dumb, but I can't find
>the
>> right combination.
>>
>> Regards,
>>
>> Terry
>>
>> ----- Original Message -----
>> From: Peter Hearty <peter.hearty@lutris.com>
>> To: Terry Steichen <terry@net-frame.com>
>> Sent: Monday, June 19, 2000 11:50 PM
>> Subject: Re: Subquery support?
>>
>>
>> > Terry
>> >
>> > Yes - IDB supports sub-queries in SELECTs. Can you give me an example
>> where
>> > it's failing (a self-contained runnable script is likely to get a
>quicker
>> > response).
>> >
>> > Regards
>> >
>> > Peter Hearty
>> > Lutris Technologies UK Ltd.
>> > -----Original Message-----
>> > From: Terry Steichen <terry@net-frame.com>
>> > To: Peter Hearty <peter.hearty@lutris.com>
>> > Date: 19 June 2000 22:45
>> > Subject: Subquery support?
>> >
>> >
>> > >Peter,
>> > >
>> > >Does IDB support subqueries? If so, could you give me a few tips on
>how
>> to
>> > >use them? (I keep getting a reserved word error on the nested
'select'
>> > >statement.)
>> > >
>> > >Regards,
>> > >
>> > >Terry
>> > >
>> > >
>> >
>> >
>>
>
>
-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.
|