i have a query in mssql server 7.0 which is working fine but i want to rewrite the query for mysql 5.0 or mysql 4.01 (as running the same query in mysql 4.01 or 5.0 versions just hangs the system)..the query is..

SELECT DISTINCT name, city1, cey.cey_id FROM cey, ceycomdet WHERE cey.cey_id = ceycomdet.cey_id AND subey_id LIKE 'c%' AND cey.cey_id IN (SELECT cey_id FROM CEYP WHERE psubcn_id = '$psubc2_id' UNION SELECT ceylo_id FROM CEYPNR WHERE cey_id IN (SELECT cey_id FROM CEYP WHERE psubcn_id ='$psubc2_id')) ORDER BY city1, name

pl. help me as i have failed to rewrite query using joins etc.