-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lenny Sorey wrote:
I'm going to try this one more time. Just trying to keep my question at the top so someone will read it and possibly respond.

Sorry to be a bother, but I've been working on this problem for three days with no succcess.

I store the result(s) of a multiple select listbox in a MySQL version 4.0.2 varchar field
i.e. 2,3,4,5,6 as a selection example. -> these results are stored in the table category under the field name category_common.

What I'm trying to do is to use the the the above results in a query such as follows:

The column content.content_common has the values of 2 and 3 and 4 in different rows. I've enclosed category.category_common in parentheses ()
which as I understand should treat category.category_common as a list.

My question is the following query something that MySQL can render regarding the content.content_common IN (category.category_common) statement or am I doing something very wrong?

Once again, when I manually type in (2,3,4) in place of (category.category_common), I get the right answer.

How can I convert (category.category_common) into a list MySQL can understand?

*************************************************************************************************************************************
Select content_title, content_category, content_order, content_name1
from content, category
where category.category_id = 'Intbk' AND content.content_common IN (category.category_common)
Order by content.content_order
************************************************************************************************************************************
According to SQL-99, the predicate for IN must be a row expression (an actual list) or be a subquery. A table column name is not allowed.

If you use MySQL-4.1, you can use a subquery for the IN argument:

IN (SELECT ....)

In any older version of MySQL, you will have to build that list by hand with an extra query.

-Mark
- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+B3hNtvXNTca6JD8RAlkwAKCi+uN7OPV4ByazPtfJcCmyofsmdQCgq8hR
LaQmJO6nLrmSzuyj7jvh3NA=
=TIpb
-----END PGP SIGNATURE-----


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