Hi Bennett,

----- Original Message -----
From: "Bennett Haselton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 09, 2001 12:31 PM
Subject: "IN" keyword supported?


> I'm trying to use the "IN" operator as described in my databases textbook
> from college.  This query:
>
> select count(*) from user where user.ID in (select ID from user);
>
> is supposed to evaluate to "count the number of rows in the 'user' table
> where the ID field is in the set of all ID field values in the 'user'
> table" (in other words, just a roundabout way of counting the rows in the
> 'user' table, written solely to demonstrate the "IN" keyword).
>
> There doesn't seem to be a syntax error in that example, but MySQL gives
> the error:
>
> ERROR 1064: You have an error in your SQL syntax near 'select ID from
> user)' at line 1
>
> Is the "IN" keyword not supported in MySQL, or am I using it wrong?
>

Subqueries are not supported in mySQL.  Have to rewrite it with a
combination of outer joins to do the same thing.

Have a look at section 1.7.4.1 in the manual.

Tony



---------------------------------------------------------------------
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

Reply via email to