Re: MYSQL reporting an error with subquery query
Hi, In your SQL statement you have used subquery. The subquery feature is introduced in MySQL version 4.1 and later. Thats why you are getting the Syntax error while running subquery in v4.0.24. Thanks, ViSolve DB Team - Original Message - From: "A Blossom of Paradise" <[EMAIL PROTECTED]> To: Sent: Tuesday, January 23, 2007 7:07 AM Subject: MYSQL reporting an error with subquery query Hello Fellow MySqueelers!, SELECT version() reveals... 4.0.24-nt-max-log I have looked at the following query a hundred times, and cannot find how MYSQL can report a syntax error to me. query string is... SELECT RAND() AS `RAND`, `prod`.`id` FROM `prod` JOIN `pack` ON `prod`.`id` = `pack`.`pid` WHERE `pack`.`did` = 3 AND NOT ( `prod`.`id` IN ( SELECT `pack1`.`pid` FROM `ogrp` AS `ogrp1` JOIN `oitm` AS `oitm1` ON `ogrp1`.`id` = `oitm1`.`gid` JOIN `pack` AS `pack1` ON `oitm1`.`pid` = `pack1`.`id` WHERE `ogrp1`.`raid` = 9 AND `ogrp1`.`wid` = 3 AND `ogrp1`.`rdate` > DATE_SUB( CURDATE(), INTERVAL 3 MONTH ) ) ) ORDER BY `RAND` LIMIT 3 Error number is 1064 Error message is '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 `pack1`.`pid` FROM `ogrp` AS `ogrp1` JOIN `oitm` AS `o' any suggestions before i squeel? -wh No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.410 / Virus Database: 268.16.13/634 - Release Date: 1/17/2007 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MYSQL reporting an error with subquery query
In the last episode (Jan 23), A Blossom of Paradise said: > SELECT version() > > reveals... > > 4.0.24-nt-max-log > > I have looked at the following query a hundred times, and cannot find > how MYSQL can report a syntax error to me. 4.0 does not support subqueries. You will need to upgrade to at least 4.1, preferably 5.0. If you are stuck with 4.0, take a look at http://dev.mysql.com/doc/refman/4.1/en/rewriting-subqueries.html for hints on rewriting the query using joins or temporary tables. -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
MYSQL reporting an error with subquery query
Hello Fellow MySqueelers!, SELECT version() reveals... 4.0.24-nt-max-log I have looked at the following query a hundred times, and cannot find how MYSQL can report a syntax error to me. query string is... SELECT RAND() AS `RAND`, `prod`.`id` FROM `prod` JOIN `pack` ON `prod`.`id` = `pack`.`pid` WHERE `pack`.`did` = 3 AND NOT ( `prod`.`id` IN ( SELECT `pack1`.`pid` FROM `ogrp` AS `ogrp1` JOIN `oitm` AS `oitm1` ON `ogrp1`.`id` = `oitm1`.`gid` JOIN `pack` AS `pack1` ON `oitm1`.`pid` = `pack1`.`id` WHERE `ogrp1`.`raid` = 9 AND `ogrp1`.`wid` = 3 AND `ogrp1`.`rdate` > DATE_SUB( CURDATE(), INTERVAL 3 MONTH ) ) ) ORDER BY `RAND` LIMIT 3 Error number is 1064 Error message is '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 `pack1`.`pid` FROM `ogrp` AS `ogrp1` JOIN `oitm` AS `o' any suggestions before i squeel? -wh