This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Mysql query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Mysql query" Watch "Mysql query" New topic
Author

Mysql query

sean zang
Ranch Hand

Joined: Apr 22, 2000
Posts: 33
Dear All;
MYSQL Query does not support following statements
" SELECT * FROM table1 WHERE id NOT IN (SELECT id FROM table2);
SELECT * FROM table1 WHERE NOT EXISTS (SELECT id FROM table2 where table1.id=table2.id) "
Does any JDBC expert tell me how to replace those queries with MYSQL statements?
Sean
thanks in advance
SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
Hi, this is the answer i think it works.
SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL;
You can find this on Mysql homepage.
sean zang
Ranch Hand

Joined: Apr 22, 2000
Posts: 33
Hi,SoonAnn Lim
thanks for you reply !
I have alrady solved by coding in JDBC
Sean
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
sean zang,
Please post your code so us others can learn!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mysql query
 
Similar Threads
how to improve performance
MySQL Query
how to get child table values from parent query
Query help
How can we use query containing two or more tables!