Gossamer Forum
Home : General : Databases and SQL :

SQL query problem - can you find the error???

Quote Reply
SQL query problem - can you find the error???
Hey all,

I'm using mySQL and am trying to query a database with the following code:

strSQL = "SELECT * " _

& "FROM listings " _

& "WHERE ID LIKE " & property_id & " " _

& "AND city_nm LIKE '%" & city_nm & "%' " _

& "AND state_nm LIKE '%" & state_nm & "%' " _

& "AND bedroom_nb LIKE " & bedroom_nb & " " _

& "AND Price < " & max_price & " " _

& "ORDER BY ID;"

proprty_id, bedroom_nb and max_price are of type INT

city_nm and state_nm are of type TEXT

The query is not working ad i'm not sure where i have gone wrong with the sql syntax, maybe i'm not referencing data types correctly, please have a look...
Quote Reply
Re: [atamir] SQL query problem - can you find the error??? In reply to
So what's the sql error?