Using where xxxx in (select ...... )

2001-05-08 Thread green jon

Hello,

I have recently converted my Java Servlets to run against mySQL where previously I was 
using Microsoft Access. I use Tomcat and have swapped drivers etc and everything works 
fine, more or less. However, I have one big problem which is as follows :-

My servlet software dynamically builds SQL of the following form, which to my 
knowledge is fairly standard :-

-

Query is: select * from service where ((primary_category in (select sub_category
from category where sport = 1 )));

java.sql.SQLException: Syntax error or access violation: You have an error in yo
ur SQL syntax near 'select sub_category from category where sport = 1 )))' at li
ne 1

-

The text above is copied directly from some diagnostics on my Tomcat console.

If I use exactly the same query from phpMyAdmin I get exactly the same error so it's 
not my JDBC driver that's at fault.

Why won't mySQL let me use this construct ?

Many thanks.

Jon Green.




Re: Using where xxxx in (select ...... )

2001-05-08 Thread Steve Ruby

green jon wrote:
 
 Hello,
 
 I have recently converted my Java Servlets to run against mySQL where previously I 
was using Microsoft Access. I use Tomcat and have swapped drivers etc and everything 
works fine, more or less. However, I have one big problem which is as follows :-



http://www.mysql.com/doc/M/i/Missing_Sub-selects.html

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Using where xxxx in (select ...... )

2001-05-08 Thread MikemickaloBlezien

On Tue, 8 May 2001 22:38:52 +0100, green jon [EMAIL PROTECTED]   wrote:

MySQL currently does not support sub select queries


Hello,

I have recently converted my Java Servlets to run against mySQL where previously I 
was using Microsoft Access. I use Tomcat and have swapped drivers etc and everything 
works fine, more or less. However, I have one big problem which is as follows :-

My servlet software dynamically builds SQL of the following form, which to my 
knowledge is fairly standard :-

-

Query is: select * from service where ((primary_category in (select sub_category
from category where sport = 1 )));

java.sql.SQLException: Syntax error or access violation: You have an error in yo
ur SQL syntax near 'select sub_category from category where sport = 1 )))' at li
ne 1

-

The text above is copied directly from some diagnostics on my Tomcat console.

If I use exactly the same query from phpMyAdmin I get exactly the same error so it's 
not my JDBC driver that's at fault.

Why won't mySQL let me use this construct ?

Many thanks.

Jon Green.

Mike(mickalo)Blezien

Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225) 686-2002
=















-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php