"Gregorio" <[EMAIL PROTECTED]> wrote on 25/02/2004 15:19:43:

> This is the query i want to run but i doesn't work.
>
> select id from c_table where users_id in (select id from users where
> locations_id=3) order by data_ora
>
> But it gives me this error:
>
> 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 id from users where locations_id=3) order by data_ora
>
> It seems correct to me. What's the problem?

Which MySQL version are you using.? Subselects (which is what this is
called) are only implemented from MySQL 4.1, which is still in beta. Before
that, you have to work around using joins - see
http://www.mysql.com/doc/en/Rewriting_subqueries.html.

I think your query might be phrased as

select id from c_table join users on c_table.users_id = users.id where
users.location_id = 3 ;

      Alec


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

Reply via email to