Using subqueries doesn`t work
Posted: Wed May 10, 2006 3:28 pm
Hello again,
I`m trying to update a filed with an sum from other table. I`m using this query:
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 SUM(workers) FROM buildings where uid = 20023)' at line
Is it my mistake or my mysql version is very low and don`t support subqueries. Btw how can I understand it. Is there a query witch return mysql information ( equal to phpinfo() function in PHP )
Thank you all
I`m trying to update a filed with an sum from other table. I`m using this query:
Code: Select all
UPDATE table1 SET table1field =
(SELECT SUM(table2field) FROM table2 where table2field2 = 123) WHERE table1field = 123;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 SUM(workers) FROM buildings where uid = 20023)' at line
Is it my mistake or my mysql version is very low and don`t support subqueries. Btw how can I understand it. Is there a query witch return mysql information ( equal to phpinfo() function in PHP )
Thank you all