"Gregorio" <[EMAIL PROTECTED]> wrote:
> 
> 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?
> 

Subqueries are supported in MySQL since version 4.1. In earlier versions you can 
rewrite query without a subquery:

        SELECT c_table.id FROM c_table, users
            WHERE c_table.user_id=users.id
            AND user.locations_id=3
            ORDER BY c_table.data_ora;

        http://www.mysql.com/doc/en/Rewriting_subqueries.html


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





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

Reply via email to