Rhino wrote:

From: "Ravi Malghan" <[EMAIL PROTECTED]>

Hi: I am building perl scripts which can insert data into a database
independent of the type of database. The following query works in
postgresql, but I am getting the following error when I run sql query in
mysql

mysql> SELECT ipaddress FROM ip_via_pingsweep WHERE ipaddress NOT IN (SELECT
ipaddress FROM object_subips);
ERROR 1064: 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 ipaddress FROM object_subips)' at line 1


The following 2 queries are fine: mysql> select ipaddress FROM ip_via_pingsweep; Empty set (0.00 sec)

mysql> SELECT ipaddress FROM object_subips;
Empty set (0.00 sec)


I am using 4.0.18-standard binary. Any ideas? Does this version support subselects.

In a word, no. Subselects are not supported in MySQL until version 4.1.x. This is currently available in alpha mode and I hear it is working pretty well for most people but don't know if you want to take the plunge and try it. Otherwise, you'll need to rewrite your query for MySQL.

Rhino

SELECT i.ipaddress FROM ip_via_pingsweep i LEFT JOIN object_subips o USING (ipaddress) WHERE o.ipaddress IS NULL;

Michael


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



Reply via email to