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: <mysql@lists.mysql.com>
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]

Reply via email to