List:General Discussion« Previous MessageNext Message »
From:A Blossom of Paradise Date:January 23 2007 1:37am
Subject:MYSQL reporting an error with subquery query
View as plain text  
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
Thread
MYSQL reporting an error with subquery queryA Blossom of Paradise23 Jan
  • Re: MYSQL reporting an error with subquery queryDan Nelson23 Jan
  • Re: MYSQL reporting an error with subquery queryViSolve DB Team29 Jan