Okay, false alarm, figured it out myself. For some reason SQLite doesn't
like the extra set of parens, so the following works okay,

SELECT DISTINCT * FROM (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE t1.ID = 1 UNION ALL SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE t1.ID = 2) t1

instead of,

SELECT DISTINCT * FROM (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 1)) UNION ALL (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 2)) 

Don't you find it strange though?

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: Boris Popov [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 01, 2006 7:48 PM
To: [email protected]
Subject: [sqlite] Compound Ops: syntax error?

Not sure if its me, but I just can't figure out why these queries don't
work. As far as I can tell looking at the docs all these compound ops are
supported: UNION | UNION ALL | INTERSECT | EXCEPT

Any ideas?

SQL OK:

SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1

SQL NOT OKAY 1: near "(": syntax error

SELECT DISTINCT * FROM (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 1)) EXCEPT (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 2))

SQL NOT OKAY 2: near "(": syntax error

SELECT DISTINCT * FROM (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 1)) INTERSECT (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 2)) 

SQL NOT OKAY 3: near "(": syntax error

SELECT DISTINCT * FROM (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 1)) UNION ALL (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
 FROM GR_ADDRESS t1
 WHERE (t1.ID = 2)) 

Thanks!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to