6 messages in com.mysql.lists.javaRe: SQL Question| From | Sent On | Attachments |
|---|---|---|
| Dawn Lockhart | 26 Nov 2002 10:57 | |
| Andrew Steiger | 26 Nov 2002 12:19 | |
| Dawn Lockhart | 26 Nov 2002 12:41 | |
| Mark Matthews | 26 Nov 2002 13:20 | |
| CBe...@coradiant.com | 26 Nov 2002 13:36 | |
| Arthur Fuller | 26 Nov 2002 13:38 |
| Subject: | Re: SQL Question![]() |
|---|---|
| From: | Dawn Lockhart (da...@amedx.com) |
| Date: | 11/26/2002 12:41:37 PM |
| List: | com.mysql.lists.java |
No, I get a syntax error: "ERROR 1064: You have an error in your SQL syntax near 'select id from table2)' at line 1"
I think I remember reading that MySQL doesn't support nested SELECT queries. If it does, do you know how to convert this query to a format that MySQL will recognize?
Select id from table1 where id not in (select distinct table1.id from table1, table2 where table1.id = table2.id);
Right now I'm implementing it as two separate Statements in my Java code, but would really like to only have one statement if possible.
Thanks, Dawn
Andrew Steiger wrote:
SELECT * FROM Table1 WHERE Table1.ID NOT IN (SELECT id FROM Table2)
Does this work??
Dawn Lockhart wrote:
Sorry, but I haven't used SQL in about 5 years and I don't remember which type of join I need for this example.
Table 1 Table 2 ID ID
I need to write a query that returns all of the Table 1.ID records that do not have a matching ID in Table 2.
Thanks! Dawn
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/doc/ (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <java...@lists.mysql.com> To unsubscribe, e-mail <java-unsubscribe-andrew=andr...@lists.mysql.com>




