MySQL nested select syntax error

software development

#1

I can run the queries seperately, but not together. I get a syntax error near the subquery, but I looked on Mysql.com and it looks ok to me. Any help would be greatly appreciated, I’ve been banging my head against the wall all afternoon.

SELECT LO.ilocationid, LO.vchname, LO.vchcity, LO.vchstate, LO.vchzip
FROM tbl_location LO
WHERE LO.istatus = 1 AND LO.vchzip
IN (

SELECT DISTINCT ZC.vchzipcode
FROM tbl_zipcode AS ZC
WHERE ZC.ilatitude
BETWEEN ( 39.960000 - 0.43370149771584 ) AND ( 39.960000 + 0.43370149771584 ) AND ZC.ilongitude
BETWEEN ( 83.010000 - 93.193039724288 ) AND ( 83.010000 + 93.193039724288 )
)
ORDER BY LO.vchname
LIMIT 0 , 30


#2

Subqueries are only supported in MySQL v4.1, which we don’t (yet) support:

http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html

  • Jeff @ DreamHost
  • DH Discussion Forum Admin

#3

I did phpinfo() and MySQL said version 4.1.8, which is why I thought they were supported. I did look at MySQL.com and see that they weren’t supported in earlier versions.

Thanks!
-Angela