0

The following sql query works fine on my development server running mysql 5, but when I try it on my live server running mysql 4 it throws an error, can anyone help show me how to adapt my query to run on mysql 4?

select * FROM Properties WHERE propertyid IN (select id from todelete)
powtac
  • 40,542
  • 28
  • 115
  • 170
Simon Foster
  • 646
  • 3
  • 11
  • 26

2 Answers2

3

Subqueries are not supported in versions lower than Mysql 4.1.

http://dev.mysql.com/doc/refman/4.1/en/subqueries.html

Blake Pettersson
  • 8,927
  • 3
  • 27
  • 36
1
SELECT * FROM Properties RIGHT JOIN todelete ON (Properties.propertyid = todelete.id);

To delete all rows from Properties which match this condition use this:

DELETE Properties FROM Properties INNER JOIN todelete ON (Properties.propertyid = todelete.id);

See T-SQL: Selecting rows to delete via joins

Community
  • 1
  • 1
powtac
  • 40,542
  • 28
  • 115
  • 170
  • Thats great but I want to delete the results of this query from Properties table and I can't do that with the above query – Simon Foster Mar 04 '11 at 14:03