Hi Renee,

Check the version of your MySQL. The subqueries feature is available from
MySQL 4.1

Hope this helps you.


- Harish

-----Original Message-----
From: Renee Henderson [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 23, 2004 6:17 AM
To: mysql@lists.mysql.com
Subject: simple subquery syntax not working!


I have read through quite a bit of the MySQL manual concerning subqueries
and cannot
seem to get even the simplist of queries to work!

I have a table called PersonRole which is the many-to-many joint table
between two
upper tables, Person and Role.  I have tested the two pieces of the query
alone and
they work fine.  (e.g. if I enter a "5" after the equal sign, it works and
if I just
type the subquery alone, it returns the single number 5.)

So, why does mysql give me a syntax error?
---------------------------------------------------------------
SELECT personRoleDBNum FROM PersonRole
WHERE roleDBNum = (SELECT roleDBNum FROM Role WHERE role = 'STAFF')

ERROR 1064: You have an error in your SQL syntax.  Check the manual that
corresponds
to your MySQL server version for the right syntax to use near 'SELECT
roleDBNum FROM
Role WHERE role = 'STAFF')' at line 2
---------------------------------------------------------------

I must be dumb or just really really confused.  Any help would be greatly
appreciated.

Renee





=====
********************************************************
Renee Henderson -- [EMAIL PROTECTED] (WA state)
Computer Programmer / Internet Specialist

"When you were born, you cried and the world rejoiced.  Live your
life in such a way that when you die, the world cries, and you
rejoice."
********************************************************

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to